Skip to content

Commit

Permalink
s3 NotFound error check use types.NotFound
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtwinkle committed Jun 20, 2023
1 parent 370a189 commit 5712a11
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions aws/awss3/awss3.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,9 @@ func HeadObject(ctx context.Context, region awsconfig.Region, bucketName BucketN
Key: key.AWSString(),
})
if err != nil {
var ae smithy.APIError
if errors.As(err, &ae) {
if ae.ErrorCode() == "NotFound" {
return nil, ErrNotFound
}
var nond *types.NotFound
if errors.As(err, &nond) {
return nil, ErrNotFound
}
return nil, err
}
Expand Down Expand Up @@ -243,14 +241,9 @@ func GetObjectWriter(ctx context.Context, region awsconfig.Region, bucketName Bu
Key: key.AWSString(),
})
if err != nil {
var oe *smithy.OperationError
if errors.As(err, &oe) {
var resErr *awshttp.ResponseError
if errors.As(oe.Err, &resErr) {
if resErr.Response.StatusCode == http.StatusNotFound {
return ErrNotFound
}
}
var nond *types.NotFound
if errors.As(err, &nond) {
return ErrNotFound
}
return err
}
Expand Down

0 comments on commit 5712a11

Please sign in to comment.