8000 errors.py: Add support for JSON content that has `errors` instead of `detail` or `details` · Issue #1279 · googleapis/google-api-python-client · GitHub
[go: up one dir, main page]

Skip to content
errors.py: Add support for JSON content that has errors instead of detail or details #1279
Closed
@vinay-google

Description

@vinay-google

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Is your feature request related to a problem? Please describe.

We have been using errors.py to raise HttpError errors. Unfortunately, many of our instances have content that matches the following format:

{
  error: {
    errors: {
    }
  }
}

versus what _get_reason 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.">

Describe the solution you'd like

The solution involves modifying _get_reason to also support error_detail_keyword with an additional value of errors. This modifies the order to: detail, details, errors, message

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0