Skip to main content

AwsError

Struct AwsError 

Source
pub struct AwsError(/* private fields */);
Expand description

Compact pointer-sized error type (size_of::<AwsError>() == size_of::<usize>()).

Boxing the inner payload keeps Result<T, AwsError> and async future state machines minimal on the stack on the happy path.

Implementations§

Source§

impl AwsError

Source

pub fn new( kind: AwsErrorKind, message: impl Into<Cow<'static, str>>, correlation_id: impl Into<Cow<'static, str>>, retryability: Retryability, ) -> Self

Creates an AwsError with full control over classification, retryability, and details.

Source

pub fn validation( message: impl Into<Cow<'static, str>>, correlation_id: impl Into<Cow<'static, str>>, ) -> Self

Creates a non-retryable validation error.

Source

pub fn credentials( message: impl Into<Cow<'static, str>>, correlation_id: impl Into<Cow<'static, str>>, ) -> Self

Creates a non-retryable credentials resolution error.

Source

pub fn signing( message: impl Into<Cow<'static, str>>, correlation_id: impl Into<Cow<'static, str>>, ) -> Self

Creates a non-retryable SigV4 signing error.

Source

pub fn transport( message: impl Into<Cow<'static, str>>, correlation_id: impl Into<Cow<'static, str>>, ) -> Self

Creates a retryable transport error.

Source

pub fn timeout( message: impl Into<Cow<'static, str>>, correlation_id: impl Into<Cow<'static, str>>, ) -> Self

Creates a retryable timeout error.

Source

pub fn serialization( message: impl Into<Cow<'static, str>>, correlation_id: impl Into<Cow<'static, str>>, ) -> Self

Creates a non-retryable request serialization error.

Source

pub fn deserialization( message: impl Into<Cow<'static, str>>, correlation_id: impl Into<Cow<'static, str>>, ) -> Self

Creates a non-retryable response deserialization error.

Source

pub fn service( kind: AwsErrorKind, details: ServiceErrorDetails, correlation_id: impl Into<Cow<'static, str>>, retryability: Retryability, ) -> Self

Creates a structured AWS service error.

Source

pub fn not_found( message: impl Into<Cow<'static, str>>, correlation_id: impl Into<Cow<'static, str>>, ) -> Self

Creates a non-retryable resource-not-found error.

Source

pub fn already_exists( message: impl Into<Cow<'static, str>>, correlation_id: impl Into<Cow<'static, str>>, ) -> Self

Creates a non-retryable already-exists error.

Source

pub fn throttled( message: impl Into<Cow<'static, str>>, correlation_id: impl Into<Cow<'static, str>>, retry_after: Option<Duration>, ) -> Self

Creates a retryable throttling error with optional Retry-After hint.

Source

pub fn waiter_timeout( message: impl Into<Cow<'static, str>>, correlation_id: impl Into<Cow<'static, str>>, ) -> Self

Creates a waiter timeout error.

Source

pub fn waiter_cancelled( message: impl Into<Cow<'static, str>>, correlation_id: impl Into<Cow<'static, str>>, ) -> Self

Creates a waiter cancellation error.

Source

pub fn batch_partial_failure( message: impl Into<Cow<'static, str>>, correlation_id: impl Into<Cow<'static, str>>, ) -> Self

Creates a batch partial-failure error.

Source

pub fn with_details(self, details: impl Into<Cow<'static, str>>) -> Self

Attaches internal diagnostic details, subject to boundary redaction.

Source

pub fn with_service_error(self, service_error: ServiceErrorDetails) -> Self

Attaches structured AWS service error details.

Source

pub fn with_retryability(self, retryability: Retryability) -> Self

Overrides the retryability classification of this error.

Source

pub fn redact_for_boundary(self, expose_details: bool) -> Self

Strips internal details unless expose_details is explicitly true.

Source§

impl AwsError

Source

pub fn kind(&self) -> AwsErrorKind

Returns the error classification.

Source

pub fn is_not_found(&self) -> bool

Returns true when the target resource or key was not found.

Source

pub fn is_already_exists(&self) -> bool

Returns true when resource creation failed because it already exists.

Source

pub fn is_throttled(&self) -> bool

Returns true when the request was throttled by the AWS service or retry budget.

Source

pub fn is_timeout(&self) -> bool

Returns true when either an HTTP call or a waiter timed out.

Source

pub fn is_credentials(&self) -> bool

Returns true when credential resolution or authorization failed.

Source

pub fn is_validation(&self) -> bool

Returns true when client-side validation failed before sending a request.

Source

pub fn http_status(&self) -> Option<u16>

Returns the HTTP status code reported by the AWS service, if available.

Source

pub fn error_code(&self) -> Option<&str>

Returns the structured AWS service error code (e.g. "NoSuchBucket"), if available.

Source

pub fn request_id(&self) -> Option<&str>

Returns the AWS request identifier (x-amz-request-id / x-amzn-requestid), if available.

Source

pub fn message(&self) -> &str

Returns the primary error message.

Source

pub fn correlation_id(&self) -> &str

Returns the correlation identifier for tracing across retries and waiters.

Source

pub fn service_error(&self) -> Option<&ServiceErrorDetails>

Returns structured AWS service error details, if any.

Source

pub fn retryability(&self) -> Retryability

Returns retryability metadata.

Source

pub fn is_retryable(&self) -> bool

Returns true if the error is retryable.

Source

pub fn details(&self) -> Option<&str>

Returns optional diagnostic details when exposure was enabled.

Trait Implementations§

Source§

impl Clone for AwsError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AwsError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for AwsError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for AwsError

Source§

impl Error for AwsError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Replaced by Error::source.
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for AwsError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AwsError

Auto Trait Implementations§

§

impl Forget for AwsError

§

impl Freeze for AwsError
where *const AwsErrorInner is !null: Freeze, PhantomData<AwsErrorInner>: Freeze,

§

impl Move for AwsError

§

impl RefUnwindSafe for AwsError

§

impl Send for AwsError
where BoxRaw<AwsErrorInner>: Send,

§

impl Sync for AwsError
where BoxRaw<AwsErrorInner>: Sync,

§

impl Unpin for AwsError
where Box<AwsErrorInner>: Unpin,

§

impl UnsafeUnpin for AwsError
where *const AwsErrorInner is !null: UnsafeUnpin, PhantomData<AwsErrorInner>: UnsafeUnpin,

§

impl UnwindSafe for AwsError
where BoxRaw<AwsErrorInner>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.