-
Notifications
You must be signed in to change notification settings - Fork 188
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
Error types should not implement source
_and_ print inner error in Display
#1345
Comments
The same is the case for |
yeah this is definitely the case currently—is there a plan to add backtrace reporting by default? I worry about customers not using a "fancy" printer missing error context |
I guess this may guide us towards "use display but not source"? |
2 tasks
Implemented as part of #1926 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SdkError
, and possibly other error types within the SDK, currently expose inner errors both throughError::source
andfmt::Display
:https://github.com/awslabs/smithy-rs/blob/692bf94ba30f570365f559c67d6a9981c037c371/rust-runtime/aws-smithy-http/src/result.rs#L176-L206
The recommendation in the ecosystem is to either return inner errors through
Error::source
or print the inner error inDisplay
, but never both (see rust-lang/project-error-handling#27 (comment), rust-lang/project-error-handling#23, rust-lang/api-guidelines#210), as otherwise errors end up being duplicated whenever error reporters print error backtraces. For example, I recently got an error trace that ended in:The text was updated successfully, but these errors were encountered: