Skip to content

feat(storage): wrap NotFound errors for buckets and objects#11519

Merged
BrennaEpp merged 3 commits into
googleapis:mainfrom
BrennaEpp:feat-notfound
Jan 31, 2025
Merged

feat(storage): wrap NotFound errors for buckets and objects#11519
BrennaEpp merged 3 commits into
googleapis:mainfrom
BrennaEpp:feat-notfound

Conversation

@BrennaEpp

@BrennaEpp BrennaEpp commented Jan 29, 2025

Copy link
Copy Markdown
Contributor

Code that checks directly against ErrBucketNotExist and ErrObjectNotExist will break; use errors.Is() instead.

This change allows users to inspect the underlying error.
Fixes #2587

Code that checks directly against ErrBucketNotExist and ErrObjectNotExist will break;
use `errors.Is()` instead.
@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Jan 29, 2025
@BrennaEpp BrennaEpp marked this pull request as ready for review January 29, 2025 04:02
@BrennaEpp BrennaEpp requested review from a team January 29, 2025 04:02

@tritone tritone left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, nice changes!

Maybe add to the docs for the sentinel errors that they should be checked using errors.Is?

@BrennaEpp BrennaEpp enabled auto-merge (squash) January 31, 2025 00:28
@BrennaEpp BrennaEpp merged commit 0dd7d3d into googleapis:main Jan 31, 2025
@BrennaEpp BrennaEpp deleted the feat-notfound branch January 31, 2025 00:46
klakin-pivotal added a commit to cloudfoundry/bosh-gcscli that referenced this pull request Mar 17, 2025
Version 1.51.0 of the 'cloud.google.com/go/storage' library wraps
NotFound errors for buckets and objects. As described in the PR
introducing the change, this breaks client code that doesn't use
'errors.Is()' to check the error type.

This commit updates the client code to work the way the library now
expects it to.

The PR that introduces the breaking change in question is here:
<googleapis/google-cloud-go#11519>
a-nogikh added a commit to a-nogikh/syzkaller that referenced this pull request May 2, 2025
After googleapis/google-cloud-go#11519, the
cloud storage library wraps the errors which we used to check directly.
This has led to multiple asset upload errors.
github-merge-queue Bot pushed a commit to google/syzkaller that referenced this pull request May 2, 2025
After googleapis/google-cloud-go#11519, the
cloud storage library wraps the errors which we used to check directly.
This has led to multiple asset upload errors.
vanja-p added a commit to buildbuddy-io/buildbuddy that referenced this pull request Jul 25, 2025
)

Reverts #9938

This upgrades the GCS dependency again, but this time fixing the error
handling that was broken by
googleapis/google-cloud-go#11519. I confirmed
that the new error handling works for both HTTP and gRPC.
mpalmi added a commit to hashicorp/vault that referenced this pull request Jul 31, 2025
…31274)

After googleapis/google-cloud-go#11519, errors
must be checked with `errors.Is`.

Addresses #31125.

Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

storage: disambiguate errors when accessing object attributes

2 participants