FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: Adds support for errors.py to also use 'errors' for error_details by vinay-google · Pull Request #1281 · googleapis/google-api-python-client · GitHub

feat: Adds support for errors.py to also use 'errors' for error_details - #1281

Merged
gcf-merge-on-green[bot] merged 3 commits into
googleapis:masterfrom
vinay-google:issue-1279
Apr 3, 2021
Merged

feat: Adds support for errors.py to also use 'errors' for error_details #1281
gcf-merge-on-green[bot] merged 3 commits into
googleapis:masterfrom
vinay-google:issue-1279

Conversation

Copy link
Copy Markdown
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #1279 🦕

vinay-google requested a review from a team April 3, 2021 05:52
google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Apr 3, 2021
Fixes googleapis#1279

We have been using [errors.py](https://github.com/googleapis/google-api-python-client/blob/master/googleapiclient/errors.py) to raise HttpError errors. Unfortunately, many of our instances have content that matches the following format:
```
{
  error: {
    errors: {
    }
  }
}
```
versus what [_get_reason](https://github.com/googleapis/google-api-python-client/blob/master/googleapiclient/errors.py#L64) is looking for i.e. only one of `detail`, `details`, or `message`
This results us seeing the errors being logged but not the details:

```
<HttpError 503 when requesting url returned "Internal error. Please try again.">
```

The solution involves modifying [_get_reason](https://github.com/googleapis/google-api-python-client/blob/master/googleapiclient/errors.py#L64) to also support `error_detail_keyword` with an additional value of `errors`. This modifies the order to: `detail`, `details`, `errors`, `message`
vinay-google changed the title Adds support for errors.py to also use 'errors' for error_details feat: Adds support for errors.py to also use 'errors' for error_details Apr 3, 2021
parthea added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 3, 2021
yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 3, 2021

parthea left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM. Thanks for the fix @vinay-google!

parthea added the automerge Merge the pull request once unit tests and other checks pass. label Apr 3, 2021
gcf-merge-on-green Bot merged commit a5d2081 into googleapis:master Apr 3, 2021
gcf-merge-on-green Bot removed the automerge Merge the pull request once unit tests and other checks pass. label Apr 3, 2021
gcf-merge-on-green Bot pushed a commit that referenced this pull request Apr 13, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

errors.py: Add support for JSON content that has errors instead of detail or details

3 participants


Back | FazBrowse Home | New Git URL