Error types should not implement source
_and_ print inner error in Display
#1345
Closed
source
_and_ print inner error in Display
#1345
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: