-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Implement errors.Unwrap for awserr.Error #2820
Comments
We utilize Because errors in our code may be wrapped, we use if errors.Is(err, context.DeadlineExceeded) { ... } Unfortunately, errors produced by c := make(chan error)
ctx, cancel := context.WithTimeout(ctx, 5*time.Minute)
defer cancel()
// move the cancellable logic into a goro!
go func() {
defer close(c)
if err := DoAWSThing1(ctx, ...); err != nil {
c <- err
return
}
if err := DoAWSThing2(ctx, ...); err != nil {
c <- err
return
}
if err := DoAWSThing3(ctx, ...); err != nil {
c <- err
return
}
}()
select {
case <-ctx.Done():
return ctx.Err()
case err := <-c:
// extra defence against awserr.Error-s that bury
// context deadline error in OrigErr :(
if ctxerr := ctx.Err(); ctxerr != nil {
return ctxerr
}
return err
} |
OMG I'm having this exact problem. The errors returned are impossible to be checked using I will definitely try your workaround @paxan ! Thanks for the idea! |
The aws/aws-sdk-go-v2 uses errors.Unwrap. We do not have plans to support this in V1 SDK. Please take a look at the v2 sdk. |
|
Hi @skotambkar Any chance to get it supported with a merge request like #4010? We have issues updating to v2 left alone that there are things that aren't even supported like DAX. |
Feature description
awserr.Error implement a method called Orig(), It's exactly same as errors.Unwrap defined in errors from go1.13. It's better to keep consistent with standard library.
The text was updated successfully, but these errors were encountered: