Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from Apr 3, 2021

Conversation

@vinay-google
Copy link
Contributor

@vinay-google vinay-google commented Apr 3, 2021

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 vinay-google requested a review from as a code owner Apr 3, 2021
@google-cla google-cla bot added the cla: yes label Apr 3, 2021
vinay-google added 2 commits 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 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
parthea approved these changes Apr 3, 2021
Copy link
Contributor

@parthea parthea left a comment

LGTM. Thanks for the fix @vinay-google!

@gcf-merge-on-green gcf-merge-on-green bot merged commit a5d2081 into googleapis:master Apr 3, 2021
3 checks passed
gcf-merge-on-green bot pushed a commit that referenced this issue Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants