aws_sdk_signin/
error_meta.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// All possible error types for this service.
3#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6    /// Error thrown for access denied scenarios with flexible HTTP status mapping Runtime HTTP Status Code Mapping: - HTTP 401 (Unauthorized): TOKEN_EXPIRED, AUTHCODE_EXPIRED - HTTP 403 (Forbidden): USER_CREDENTIALS_CHANGED, INSUFFICIENT_PERMISSIONS The specific HTTP status code is determined at runtime based on the error enum value. Consumers should use the error field to determine the specific access denial reason.
7    AccessDeniedException(crate::types::error::AccessDeniedException),
8    /// Error thrown when an internal server error occurs HTTP Status Code: 500 Internal Server Error Used for unexpected server-side errors that prevent request processing.
9    InternalServerException(crate::types::error::InternalServerException),
10    /// Error thrown when rate limit is exceeded HTTP Status Code: 429 Too Many Requests Possible OAuth2ErrorCode values: - INVALID_REQUEST: Rate limiting, too many requests, abuse prevention Possible causes: - Too many token requests from the same client - Rate limiting based on client_id or IP address - Abuse prevention mechanisms triggered - Service protection against excessive token generation
11    TooManyRequestsError(crate::types::error::TooManyRequestsError),
12    /// Error thrown when request validation fails HTTP Status Code: 400 Bad Request Used for request validation errors such as malformed parameters, missing required fields, or invalid parameter values.
13    ValidationException(crate::types::error::ValidationException),
14    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
15    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
16    variable wildcard pattern and check `.code()`:
17     \
18       `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
19     \
20    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
21    Unhandled(crate::error::sealed_unhandled::Unhandled),
22}
23impl ::std::fmt::Display for Error {
24    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25        match self {
26            Error::AccessDeniedException(inner) => inner.fmt(f),
27            Error::InternalServerException(inner) => inner.fmt(f),
28            Error::TooManyRequestsError(inner) => inner.fmt(f),
29            Error::ValidationException(inner) => inner.fmt(f),
30            Error::Unhandled(_) => {
31                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
32                    write!(f, "unhandled error ({code})")
33                } else {
34                    f.write_str("unhandled error")
35                }
36            }
37        }
38    }
39}
40impl From<::aws_smithy_types::error::operation::BuildError> for Error {
41    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
42        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
43            source: value.into(),
44            meta: ::std::default::Default::default(),
45        })
46    }
47}
48impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
49    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
50        match self {
51            Self::AccessDeniedException(inner) => inner.meta(),
52            Self::InternalServerException(inner) => inner.meta(),
53            Self::TooManyRequestsError(inner) => inner.meta(),
54            Self::ValidationException(inner) => inner.meta(),
55            Self::Unhandled(inner) => &inner.meta,
56        }
57    }
58}
59impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_o_auth2_token::CreateOAuth2TokenError, R>> for Error
60where
61    R: Send + Sync + std::fmt::Debug + 'static,
62{
63    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_o_auth2_token::CreateOAuth2TokenError, R>) -> Self {
64        match err {
65            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
66            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
67                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
68                source: err.into(),
69            }),
70        }
71    }
72}
73impl From<crate::operation::create_o_auth2_token::CreateOAuth2TokenError> for Error {
74    fn from(err: crate::operation::create_o_auth2_token::CreateOAuth2TokenError) -> Self {
75        match err {
76            crate::operation::create_o_auth2_token::CreateOAuth2TokenError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
77            crate::operation::create_o_auth2_token::CreateOAuth2TokenError::InternalServerException(inner) => Error::InternalServerException(inner),
78            crate::operation::create_o_auth2_token::CreateOAuth2TokenError::TooManyRequestsError(inner) => Error::TooManyRequestsError(inner),
79            crate::operation::create_o_auth2_token::CreateOAuth2TokenError::ValidationException(inner) => Error::ValidationException(inner),
80            crate::operation::create_o_auth2_token::CreateOAuth2TokenError::Unhandled(inner) => Error::Unhandled(inner),
81        }
82    }
83}
84impl ::std::error::Error for Error {
85    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
86        match self {
87            Error::AccessDeniedException(inner) => inner.source(),
88            Error::InternalServerException(inner) => inner.source(),
89            Error::TooManyRequestsError(inner) => inner.source(),
90            Error::ValidationException(inner) => inner.source(),
91            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
92        }
93    }
94}
95impl ::aws_types::request_id::RequestId for Error {
96    fn request_id(&self) -> Option<&str> {
97        match self {
98            Self::AccessDeniedException(e) => e.request_id(),
99            Self::InternalServerException(e) => e.request_id(),
100            Self::TooManyRequestsError(e) => e.request_id(),
101            Self::ValidationException(e) => e.request_id(),
102            Self::Unhandled(e) => e.meta.request_id(),
103        }
104    }
105}