pub use aws_smithy_types::retry::ErrorKind;
pub use aws_smithy_types::retry::ProvideErrorKind;
pub use aws_smithy_types::retry::RetryConfig;
pub use aws_smithy_types::retry::RetryConfigBuilder;
pub use aws_smithy_types::retry::RetryKind;
pub use aws_smithy_types::retry::RetryMode;
pub mod error {
use std::fmt;
use std::num::ParseIntError;
pub use aws_smithy_types::retry::RetryModeParseError;
#[derive(Debug)]
pub(crate) enum RetryConfigErrorKind {
InvalidRetryMode {
source: RetryModeParseError,
},
MaxAttemptsMustNotBeZero,
FailedToParseMaxAttempts {
source: ParseIntError,
},
}
#[derive(Debug)]
pub struct RetryConfigError {
pub(crate) kind: RetryConfigErrorKind,
}
impl fmt::Display for RetryConfigError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use RetryConfigErrorKind::*;
match &self.kind {
InvalidRetryMode { .. } => {
write!(f, "invalid retry configuration")
}
MaxAttemptsMustNotBeZero { .. } => {
write!(f, "invalid configuration: It is invalid to set max attempts to 0. Unset it or set it to an integer greater than or equal to one.")
}
FailedToParseMaxAttempts { .. } => {
write!(f, "failed to parse max attempts",)
}
}
}
}
impl std::error::Error for RetryConfigError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
use RetryConfigErrorKind::*;
match &self.kind {
InvalidRetryMode { source, .. } => Some(source),
FailedToParseMaxAttempts { source, .. } => Some(source),
MaxAttemptsMustNotBeZero { .. } => None,
}
}
}
impl From<RetryConfigErrorKind> for RetryConfigError {
fn from(kind: RetryConfigErrorKind) -> Self {
Self { kind }
}
}
}