-
Notifications
You must be signed in to change notification settings - Fork 193
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
Revamp errors for aws-sigv4
#1937
Conversation
A new generated diff is ready to view.
A new doc preview is ready to view. |
88580e1
to
5c0f606
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
impl fmt::Display for SigningError { | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
match self.kind { | ||
SigningErrorKind::FailedToCreateCanonicalRequest { .. } => { | ||
write!(f, "failed to create canonical request") | ||
} | ||
} | ||
} | ||
} | ||
|
||
impl Error for SigningError { | ||
fn source(&self) -> Option<&(dyn Error + 'static)> { | ||
match &self.kind { | ||
SigningErrorKind::FailedToCreateCanonicalRequest { source } => Some(source), | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this follows #1345?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The source doesn't get written in the Display
impl so that it's not duplicated for error reporters that follow the source chain.
use std::str; | ||
|
||
/// Signing error type | ||
pub type Error = Box<dyn StdError + Send + Sync + 'static>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
@@ -121,8 +121,6 @@ impl fmt::Debug for SigV4Signer { | |||
} | |||
} | |||
|
|||
pub type SigningError = Box<dyn Error + Send + Sync>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
A new generated diff is ready to view.
A new doc preview is ready to view. |
Motivation and Context
This PR revamps errors in
aws-sigv4
to adhere to RFC-0022: Error Context and Compatibility.This PR is part of a series that will fully implement the RFC, tracked in #1926.
Changelog entries added in #1951.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.