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: Raise GoogleAPICallError on REST response errors #891

Merged
merged 4 commits into from
May 19, 2021

Conversation

vchudnov-g
Copy link
Contributor

@vchudnov-g vchudnov-g commented May 18, 2021

While testing against Showcase, I found that server errors resulted in a large exception stack dump that did not include the body of the erroring response. This PR shortens the stack dump and prints out the request body.

Fixes #769

@vchudnov-g vchudnov-g requested a review from a team as a code owner May 18, 2021 18:59
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label May 18, 2021
@codecov
Copy link

codecov bot commented May 18, 2021

Codecov Report

Merging #891 (296d8e0) into master (7c185e8) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #891   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        27    +1     
  Lines         1608      1697   +89     
  Branches       328       347   +19     
=========================================
+ Hits          1608      1697   +89     
Impacted Files Coverage Δ
gapic/samplegen_utils/types.py 100.00% <ø> (ø)
gapic/samplegen_utils/utils.py 100.00% <ø> (ø)
gapic/utils/case.py 100.00% <ø> (ø)
gapic/utils/reserved_names.py 100.00% <ø> (ø)
gapic/generator/generator.py 100.00% <100.00%> (ø)
gapic/samplegen/samplegen.py 100.00% <100.00%> (ø)
gapic/schema/api.py 100.00% <100.00%> (ø)
gapic/schema/metadata.py 100.00% <100.00%> (ø)
gapic/schema/wrappers.py 100.00% <100.00%> (ø)
gapic/utils/__init__.py 100.00% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce558ac...296d8e0. Read the comment docs.

@vchudnov-g vchudnov-g requested a review from miraleung May 18, 2021 19:34
@vchudnov-g vchudnov-g changed the title (feat) Add rest.py:ResponseError to echo error response body feat: Add rest.py:ResponseError to echo error response body May 18, 2021
@busunkim96
Copy link
Contributor

I think google-api-core has some functionality for handling error messages. Could that be used instead? See the original feature request in #769

@vchudnov-g
Copy link
Contributor Author

Oh, interesting. Thanks for the pointers! Made changes; PTAL.

@vchudnov-g vchudnov-g changed the title feat: Add rest.py:ResponseError to echo error response body feat: Raise GoogleAPICallError on REST response errors May 19, 2021
@vchudnov-g
Copy link
Contributor Author

Also changed PR title and description to match.

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.

Turn REST response exceptions into GoogleAPICallError
2 participants