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

fix(rest): return complete payloads for errors #10051

Merged
merged 2 commits into from Oct 17, 2022

Conversation

coryan
Copy link
Member

@coryan coryan commented Oct 17, 2022

We need the full payload when returning completing a HttpRequest with a non-OK status code. The payload may contain a full ErrorInfo, and we want the application to have access to those.

rest_internal::CurlImpl was converting the HTTP status code unless it was in a list of values ignored. Then storage::RestClient used a per-method predicate to convert some values to errors. It seems simpler to never convert an HTTP status code to a Status in the CurlImpl layer. After all, an HTTP request that completes with a status code was able to send and receive the call.

Fixes #9947


This change is Reviewable

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 63e346a568783b7786904d5dbcc0e216ef2c07e1

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@codecov
Copy link

codecov bot commented Oct 17, 2022

Codecov Report

Base: 94.23% // Head: 94.22% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (8ace31e) compared to base (6d3a1c5).
Patch coverage: 79.31% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10051      +/-   ##
==========================================
- Coverage   94.23%   94.22%   -0.01%     
==========================================
  Files        1527     1527              
  Lines      141847   141822      -25     
==========================================
- Hits       133669   133632      -37     
- Misses       8178     8190      +12     
Impacted Files Coverage Δ
google/cloud/internal/curl_impl.h 80.00% <ø> (ø)
...loud/internal/curl_rest_client_integration_test.cc 98.31% <ø> (-1.07%) ⬇️
google/cloud/internal/rest_response.cc 100.00% <ø> (ø)
google/cloud/storage/client_options_test.cc 100.00% <ø> (ø)
google/cloud/storage/internal/rest_client.cc 73.63% <25.00%> (-0.22%) ⬇️
...e/tests/object_resumable_write_integration_test.cc 85.13% <40.00%> (-0.78%) ⬇️
google/cloud/internal/curl_impl.cc 88.20% <100.00%> (-0.22%) ⬇️
google/cloud/storage/client_options.cc 88.33% <100.00%> (-0.13%) ⬇️
google/cloud/internal/async_connection_ready.cc 89.36% <0.00%> (-4.26%) ⬇️
...integration_tests/schema_admin_integration_test.cc 98.88% <0.00%> (-1.12%) ⬇️
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@coryan coryan marked this pull request as ready for review October 17, 2022 16:27
@coryan coryan requested a review from a team as a code owner October 17, 2022 16:27
Copy link
Member

@scotthart scotthart left a comment

Choose a reason for hiding this comment

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

Reviewed 8 of 8 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @coryan)

We need the full payload when returning completing a `HttpRequest`
with a non-OK status code. The payload may contain a full ErrorInfo, and
we want the application to have access to those.

`rest_internal::CurlImpl` was converting the HTTP status code unless it
was in a list of values ignored. Then `storage::RestClient` used a
per-method predicate to convert some values to errors.  It seems
simpler to *never* convert an HTTP status code to a `Status` in the
`CurlImpl` layer. After all, an HTTP request that completes with a
status code was able to send and receive the call.
@coryan coryan force-pushed the fix-rest-parse-full-error-payloads branch from 63e346a to 8ace31e Compare October 17, 2022 17:33
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 8ace31e766e6d0747342c8170f6b28bed3e1a968

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@coryan coryan enabled auto-merge (squash) October 17, 2022 17:55
@coryan coryan merged commit e90fd34 into googleapis:main Oct 17, 2022
@coryan coryan deleted the fix-rest-parse-full-error-payloads branch October 17, 2022 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rest Error Message are Less Useful Now
3 participants