You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My goal: Catch and handle when the bucket/key is not found
If I call _, err := myS3Client.HeadObject(....) for a nonexistent bucket (or key):
I expect one of the following errors.As to to be true but they all return false:
var noSuchBucket *types.NoSuchBucket
errors.As(err, &noSuchBucket)
var noSuchKey *types.NoSuchKey
errors.As(err, &noSuchKey)
var notFound *types.NotFound
errors.As(err, ¬Found)
The only thing that seems to work is casting it to a ResponseError and checking that the status code is a 404. Is this expected behavior?. Will any of these assertions ever return true for HeadObject if it's not found?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
My goal: Catch and handle when the bucket/key is not found
If I call
_, err := myS3Client.HeadObject(....)
for a nonexistent bucket (or key):I expect one of the following
errors.As
to to be true but they all return false:The only thing that seems to work is casting it to a
ResponseError
and checking that the status code is a 404. Is this expected behavior?. Will any of these assertions ever return true forHeadObject
if it's not found?Thank you!
Beta Was this translation helpful? Give feedback.
All reactions