-
Notifications
You must be signed in to change notification settings - Fork 607
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
Refactor SDK's error types #74
Comments
Looks like Go1.13 may have more error inspection capabilities. We should consider it part of this. https://godoc.org/golang.org/x/xerrors https://tip.golang.org/pkg/errors/ |
Thanks for the suggestion @rajender. I agree taking advantage of This would mean the SDK's minimum supported version would raise go Go 1.13. Since the SDK is still in developer preview, this is may not be a deal breaker, but 1.13 most likely won't release until around August. The SDK may need to consider back filling support for |
APIErrors returned from an API operation call should probably include the metadata for the operation request/response that failed. This context would help will logging, and identifying context of a failed operation call. Does it make sense to expose this behavior to all SDK errors that are returned from an operation call? One way this could happen is the operation's Send potentially could wrap the underlying error to ensure context is maintained. |
The SDK's error handling refactor should be built with Unwrap in mind so that layering of errors can easily be peeled apart. |
#487 made significant changes to the SDK's awserr.Error and internal error wrapping. The SDK now supports Unwrap in numerous places in the SDK. There are still several instances of SDK logic errors that are using the awserr.Error Code wrapper. Ideally the SDK doesn't use awserr.Error for any non-API error response. All SDK logic errors are typed, or generic errors. The outstanding SDK logic awserr.Error usage are a good target for further burn down. |
The v1 SDK exposes a single interface that most errors in the SDK try to conform to.
awserr.Error
. This error doesn't make sense for a lot of the errors the SDK core and utilities expose. Specifically thecode
andmessage
values only make sense for API response errors.The v2 SDK should refactor
awserr.Error
into anAPIError
interface type that basically is theawserr.RequestFailure
type. I think the genericawserr.Error
can be replaced in favor with errors that support thegithub.com/pkg/errors
package'sWrap
andCause
pattern.Refactoring these error types should also satisfy a goal of error checking in user applications should be based more on type assertions instead of string comparison.
The text was updated successfully, but these errors were encountered: