Skip to content

cleanup(storage): error handling in base64 decoding#6961

Merged
coryan merged 1 commit intogoogleapis:mainfrom
coryan:cleanup-storage-base64-decode-uses-status-or
Jul 10, 2021
Merged

cleanup(storage): error handling in base64 decoding#6961
coryan merged 1 commit intogoogleapis:mainfrom
coryan:cleanup-storage-base64-decode-uses-status-or

Conversation

@coryan
Copy link
Copy Markdown
Contributor

@coryan coryan commented Jul 9, 2021

Use StatusOr<> to signal errors when decoding base64 strings. This
required changes at the call sites, which I generally handled as
follows:

  • In tests, where the decoding is known to work, I just call .value().
  • In functions ready to return StatusOr<> I just propagate the
    failure.
  • In other functions, I changed the chain of calls until all of them had
    a Status or StatusOr<>.

Fixes #6946


This change is Reviewable

@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 9, 2021
@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Jul 9, 2021
@google-cloud-cpp-bot
Copy link
Copy Markdown
Contributor

Google Cloud Build Logs
For commit: 64d18047256c51a15453896198ea1bc6d670b88f

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 9, 2021

Codecov Report

Merging #6961 (a81312f) into main (13c1648) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #6961   +/-   ##
=======================================
  Coverage   94.56%   94.56%           
=======================================
  Files        1288     1288           
  Lines      114392   114402   +10     
=======================================
+ Hits       108172   108185   +13     
+ Misses       6220     6217    -3     
Impacted Files Coverage Δ
google/cloud/storage/internal/grpc_client.h 100.00% <ø> (ø)
google/cloud/storage/internal/openssl_util.h 100.00% <ø> (ø)
google/cloud/storage/client.cc 86.73% <100.00%> (ø)
.../cloud/storage/client_sign_policy_document_test.cc 98.42% <100.00%> (ø)
google/cloud/storage/internal/grpc_client.cc 93.65% <100.00%> (ø)
google/cloud/storage/internal/grpc_client_test.cc 100.00% <100.00%> (ø)
...d/storage/internal/grpc_object_read_source_test.cc 95.25% <100.00%> (ø)
...rage/internal/grpc_resumable_upload_session_url.cc 100.00% <100.00%> (ø)
google/cloud/storage/internal/openssl_util.cc 80.00% <100.00%> (+1.05%) ⬆️
google/cloud/storage/internal/openssl_util_test.cc 100.00% <100.00%> (ø)
... and 8 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 13c1648...a81312f. Read the comment docs.

Use StatusOr<> to signal errors when decoding base64 strings. This
required changes at the call sites, which I generally handled as
follows:

- In tests, where the decoding is known to work, I just call `.value()`.
- In functions ready to return `StatusOr<>` I just propagate the
  failure.
- In other functions, I changed the chain of calls until all of them had
  a `Status` or `StatusOr<>`.
@coryan coryan force-pushed the cleanup-storage-base64-decode-uses-status-or branch from 64d1804 to a81312f Compare July 9, 2021 21:17
@google-cloud-cpp-bot
Copy link
Copy Markdown
Contributor

Google Cloud Build Logs
For commit: a81312f3aca5356682103a6cece2c8595615505c

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

@coryan coryan marked this pull request as ready for review July 9, 2021 22:03
@coryan coryan requested a review from a team July 9, 2021 22:03
@coryan coryan merged commit 6d32bdf into googleapis:main Jul 10, 2021
@coryan coryan deleted the cleanup-storage-base64-decode-uses-status-or branch July 10, 2021 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use Spanner's base64 encoding/decoding in storage

3 participants