diff --git a/rust-runtime/aws-smithy-http/src/result.rs b/rust-runtime/aws-smithy-http/src/result.rs index 3a0bfae52a3..1f0afd72f0c 100644 --- a/rust-runtime/aws-smithy-http/src/result.rs +++ b/rust-runtime/aws-smithy-http/src/result.rs @@ -15,7 +15,6 @@ use crate::operation; use aws_smithy_types::error::metadata::{ProvideErrorMetadata, EMPTY_ERROR_METADATA}; use aws_smithy_types::error::ErrorMetadata; -use aws_smithy_types::error::InterceptorError; use aws_smithy_types::retry::ErrorKind; use std::fmt; use std::fmt::{Debug, Display, Formatter}; @@ -72,7 +71,7 @@ pub mod builders { source_only_error_builder!(TimeoutError, TimeoutErrorBuilder, BoxError); source_only_error_builder!(DispatchFailure, DispatchFailureBuilder, ConnectorError); - /// Builder for [`ResponseError`](super::ResponseError). + /// Builder for [`ResponseError`](ResponseError). #[derive(Debug)] pub struct ResponseErrorBuilder { source: Option, @@ -127,7 +126,7 @@ pub mod builders { } } - /// Builder for [`ServiceError`](super::ServiceError). + /// Builder for [`ServiceError`](ServiceError). #[derive(Debug)] pub struct ServiceErrorBuilder { source: Option, @@ -340,9 +339,6 @@ pub enum SdkError { /// An error response was received from the service ServiceError(ServiceError), - - /// An error occurred within a smithy interceptor - InterceptorError(InterceptorError), } impl SdkError { @@ -378,11 +374,6 @@ impl SdkError { Self::ServiceError(ServiceError { source, raw }) } - /// Construct a `SdkError` for a smithy interceptor failure - pub fn interceptor_error(source: InterceptorError) -> Self { - Self::InterceptorError(source) - } - /// Returns the underlying service error `E` if there is one /// /// If the `SdkError` is not a `ServiceError` (for example, the error is a network timeout), @@ -440,7 +431,6 @@ impl SdkError { ResponseError(context) => Ok(context.source), DispatchFailure(context) => Ok(context.source.into()), ServiceError(context) => Ok(context.source.into()), - InterceptorError(context) => Ok(context.into()), } } } @@ -453,7 +443,6 @@ impl Display for SdkError { SdkError::DispatchFailure(_) => write!(f, "dispatch failure"), SdkError::ResponseError(_) => write!(f, "response error"), SdkError::ServiceError(_) => write!(f, "service error"), - SdkError::InterceptorError(_) => write!(f, "an error occurred in a smithy interceptor"), } } } @@ -471,7 +460,6 @@ where ResponseError(context) => Some(context.source.as_ref()), DispatchFailure(context) => Some(&context.source), ServiceError(context) => Some(&context.source), - InterceptorError(context) => Some(context), } } } @@ -487,7 +475,6 @@ where Self::DispatchFailure(_) => &EMPTY_ERROR_METADATA, Self::ResponseError(_) => &EMPTY_ERROR_METADATA, Self::ServiceError(err) => err.source.meta(), - Self::InterceptorError(_) => &EMPTY_ERROR_METADATA, } } } diff --git a/rust-runtime/aws-smithy-types/src/config.rs b/rust-runtime/aws-smithy-types/src/config.rs deleted file mode 100644 index 35d0f3613ab..00000000000 --- a/rust-runtime/aws-smithy-types/src/config.rs +++ /dev/null @@ -1,4 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ diff --git a/rust-runtime/aws-smithy-types/src/number/error.rs b/rust-runtime/aws-smithy-types/src/number/error.rs deleted file mode 100644 index 604017d460c..00000000000 --- a/rust-runtime/aws-smithy-types/src/number/error.rs +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -use std::fmt; - -#[derive(Debug)] -pub(super) enum TryFromNumberErrorKind { - /// Used when the conversion from an integer type into a smaller integer type would be lossy. - OutsideIntegerRange(std::num::TryFromIntError), - /// Used when the conversion from an `u64` into a floating point type would be lossy. - U64ToFloatLossyConversion(u64), - /// Used when the conversion from an `i64` into a floating point type would be lossy. - I64ToFloatLossyConversion(i64), - /// Used when attempting to convert an `f64` into an `f32`. - F64ToF32LossyConversion(f64), - /// Used when attempting to convert a decimal, infinite, or `NaN` floating point type into an - /// integer type. - FloatToIntegerLossyConversion(f64), - /// Used when attempting to convert a negative [`Number`](crate::Number) into an unsigned integer type. - NegativeToUnsignedLossyConversion(i64), -} - -/// The error type returned when conversion into an integer type or floating point type is lossy. -#[derive(Debug)] -pub struct TryFromNumberError { - pub(super) kind: TryFromNumberErrorKind, -} - -impl fmt::Display for TryFromNumberError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - use TryFromNumberErrorKind::*; - match self.kind { - OutsideIntegerRange(_) => write!(f, "integer too large"), - FloatToIntegerLossyConversion(v) => write!( - f, - "cannot convert floating point number {v} into an integer" - ), - NegativeToUnsignedLossyConversion(v) => write!( - f, - "cannot convert negative integer {v} into an unsigned integer type" - ), - U64ToFloatLossyConversion(v) => { - write!( - f, - "cannot convert {v}u64 into a floating point type without precision loss" - ) - } - I64ToFloatLossyConversion(v) => { - write!( - f, - "cannot convert {v}i64 into a floating point type without precision loss" - ) - } - F64ToF32LossyConversion(v) => { - write!(f, "will not attempt to convert {v}f64 into a f32") - } - } - } -} - -impl std::error::Error for TryFromNumberError { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { - use TryFromNumberErrorKind::*; - match &self.kind { - OutsideIntegerRange(err) => Some(err as _), - FloatToIntegerLossyConversion(_) - | NegativeToUnsignedLossyConversion(_) - | U64ToFloatLossyConversion(_) - | I64ToFloatLossyConversion(_) - | F64ToF32LossyConversion(_) => None, - } - } -} - -impl From for TryFromNumberError { - fn from(value: std::num::TryFromIntError) -> Self { - Self { - kind: TryFromNumberErrorKind::OutsideIntegerRange(value), - } - } -} - -impl From for TryFromNumberError { - fn from(kind: TryFromNumberErrorKind) -> Self { - Self { kind } - } -} diff --git a/rust-runtime/aws-smithy-types/src/retry.rs b/rust-runtime/aws-smithy-types/src/retry.rs index 2358d5c1652..43be79cae43 100644 --- a/rust-runtime/aws-smithy-types/src/retry.rs +++ b/rust-runtime/aws-smithy-types/src/retry.rs @@ -61,7 +61,7 @@ pub trait ProvideErrorKind { /// - The required retry delay exceeds the maximum backoff configured by the client /// - No retry tokens are available due to service health #[non_exhaustive] -#[derive(Eq, PartialEq, Debug, Clone)] +#[derive(Eq, PartialEq, Debug)] pub enum RetryKind { /// Retry the associated request due to a known `ErrorKind`. Error(ErrorKind),