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’ll 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

Commits on Apr 3, 2021

  1. Copy the full SHA
    113f532 View commit details
    Browse the repository at this point in the history
  2. feat: Adds support for errors.py to also use 'errors' for error_details

    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 committed Apr 3, 2021
    Copy the full SHA
    76fc820 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    813ad78 View commit details
    Browse the repository at this point in the history