-
Notifications
You must be signed in to change notification settings - Fork 248
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
Upgrade guidance for error changes #657
Comments
|
noritada
added a commit
to noritada/rrr-rs
that referenced
this issue
Dec 22, 2022
Since several breaking changes have been made to errors in this update, I have used the following upgrade guide as a reference: awslabs/aws-sdk-rust#657 .
scottlamb
added a commit
to sportsball-ai/keyvaluestore-rs
that referenced
this issue
Feb 3, 2023
scottlamb
added a commit
to sportsball-ai/keyvaluestore-rs
that referenced
this issue
Feb 3, 2023
This was referenced Nov 2, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is an upgrade guide and summary of changes made in smithy-rs#1926, that will be linked in the release notes.
At a high level, errors were refactored to:
Display
impls. ADisplayErrorContext
utility has been re-exported in thetypes
module to easily log or print the entire error source chain.Error::cause
/Error::source
implAdditionally, a convenience was added to
SdkError
to make matching on the error kind easier (shown below inSdkError
Changes).Example of using
DisplayErrorContext
When logging an error from the SDK, it is recommended that you either wrap the error in
DisplayErrorContext
, or use another error reporter library that visits the error's cause/source chain.SdkError
ChangesSdkError
previously had struct variants, but those have been replaced with actual structs. This impacts matching onSdkError
. Previously, you might have something like:In the latest version,
SdkError
has aninto_service_error()
method that allows this to be simplified slightly:Full List of Changes
presigning::Error
s are no longer matchable.aws_config::ecs::InvalidFullUriError
is no longer matchable.aws_config::imds::client::ImdsError
moved intoaws_config::imds::client::error
.aws_config::imds::client::InvalidEndpointMode
moved intoaws_config::imds::client::error
.aws_config::imds::client::BuildError
moved intoaws_config::imds::client::error
, and is no longer matchable.aws_config::imds::client::TokenError
moved intoaws_config::imds::client::error
, and is no longer matchable.aws_endpoint::AwsEndpointStageError
is no longer matchable.aws_http::auth::CredentialsStageError
is no longer matchable.aws_http::user_agent::UserAgentStageError
is no longer matchable.aws_sig_auth::middleware::SigningStageError
is no longer matchable.aws_types::credentials::CredentialsError
now has separate context structs on its enum variants.aws_sigv4::signer::SigningError
is now an actual error type instead of aBox<dyn Error + Send + Sync>
.Unhandled
variant on generated errors now has anUnhandled
new type rather than aBox<dyn Error + Send + Sync + 'static>
as its tuple member.aws_smithy_async::future::timeout::TimedOutError
no longer implementsCopy
,Clone
,Eq
, andPartialEq
.aws_smithy_checksums::Error
was renamed toaws_smithy_checksums::error::UnknownChecksumAlgorithmError
, and is no longer matchable.aws_smithy_eventstream::error::Error
is no longer matchable.aws_smithy_http::endpoint::Error
was renamed toaws_smithy_http::endpoint::error::ResolveEndpointError
SdkError
variants can no longer be directly constructed. There are now functions onSdkError
to construct each individual variant.aws_smithy_http::byte_stream::Error
was moved toaws_smithy_http::byte_stream::error::Error
, and is no longer matchable.aws_smithy_http::endpoint::Error
was renamed toaws_smithy_http::endpoint::error::ResolveEndpointError
, and is no longer matchable.aws_smithy_http::endpoint::InvalidEndpoint
were moved intoaws_smithy_http::endpoint::error
, and is no longer matchable.aws_smithy_http::event_stream::Error
was renamed toaws_smithy_http::event_stream::ReceiverError
.aws_smithy_http::operation::BuildError
was renamed toaws_smithy_http::operation::error::BuildError
, and is no longer matchable.aws_smithy_http::operation::SerializationError
was renamed toaws_smithy_http::operation::error::SerializationError
, and is no longer matchable.aws_smithy_json::deserialize::Error
was renamed toaws_smithy_json::deserialize::error::DeserializeError
, and is no longer matchable.aws_smithy_json::escape::EscapeError
is no longer matchable.aws_smithy_types::base64::DecodeError
is no longer matchable, and no longer implementsClone
,Eq
, andPartialEq
.aws_smithy_types::TryFromNumberError
moved toaws_smithy_types::error::TryFromNumberError
, and is no longer matchable.aws_smithy_types::date_time::format::DateTimeParseError
is no longer matchable.aws_smithy_types::date_time::format::DateTimeFormatError
is no longer matchable.aws_smithy_types::primitive::PrimitiveParseError
no longer implementsEq
,PartialEq
, andClone
.aws_smithy_types::retry::RetryModeParseErr
was renamed toRetryModeParseError
aws_smithy_types::retry::RetryConfigErr
andaws_smithy_types::timeout::error::ConfigError
were deleted since they were no longer referenced.aws_smithy_types_convert::date_time::Error
is no longer matchable.aws_smithy_xml::decode::XmlError
was renamed toXmlDecodeError
, and is no longer matchable.aws_smithy_xml::encode::Error
was renamed toXmlEncodeError
.The text was updated successfully, but these errors were encountered: