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(_) => if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
31                                        write!(f, "unhandled error ({code})")
32                                    } else {
33                                        f.write_str("unhandled error")
34                                    }
35        }
36    }
37}
38impl From<::aws_smithy_types::error::operation::BuildError> for Error {
39                fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
40                    Error::Unhandled(crate::error::sealed_unhandled::Unhandled { source: value.into(), meta: ::std::default::Default::default() })
41                }
42            }
43impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
44                fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
45                    match self {
46                        Self::AccessDeniedException(inner) => inner.meta(),
47Self::InternalServerException(inner) => inner.meta(),
48Self::TooManyRequestsError(inner) => inner.meta(),
49Self::ValidationException(inner) => inner.meta(),
50                        Self::Unhandled(inner) => &inner.meta,
51                    }
52                }
53            }
54impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_o_auth2_token::CreateOAuth2TokenError, R>> for Error where R: Send + Sync + std::fmt::Debug + 'static {
55    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_o_auth2_token::CreateOAuth2TokenError, R>) -> Self {
56        match err {
57            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
58            _ => Error::Unhandled(
59                                        crate::error::sealed_unhandled::Unhandled {
60                                            meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
61                                            source: err.into(),
62                                        }
63                                    ),
64        }
65    }
66}
67impl From<crate::operation::create_o_auth2_token::CreateOAuth2TokenError> for Error {
68    fn from(err: crate::operation::create_o_auth2_token::CreateOAuth2TokenError) -> Self {
69        match err {
70            crate::operation::create_o_auth2_token::CreateOAuth2TokenError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
71            crate::operation::create_o_auth2_token::CreateOAuth2TokenError::InternalServerException(inner) => Error::InternalServerException(inner),
72            crate::operation::create_o_auth2_token::CreateOAuth2TokenError::TooManyRequestsError(inner) => Error::TooManyRequestsError(inner),
73            crate::operation::create_o_auth2_token::CreateOAuth2TokenError::ValidationException(inner) => Error::ValidationException(inner),
74            crate::operation::create_o_auth2_token::CreateOAuth2TokenError::Unhandled(inner) => Error::Unhandled(inner),
75        }
76    }
77}
78impl ::std::error::Error for Error {
79    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
80        match self {
81            Error::AccessDeniedException(inner) => inner.source(),
82            Error::InternalServerException(inner) => inner.source(),
83            Error::TooManyRequestsError(inner) => inner.source(),
84            Error::ValidationException(inner) => inner.source(),
85            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source)
86        }
87    }
88}
89impl ::aws_types::request_id::RequestId for Error {
90    fn request_id(&self) -> Option<&str> {
91        match self {
92            Self::AccessDeniedException(e) => e.request_id(),
93            Self::InternalServerException(e) => e.request_id(),
94            Self::TooManyRequestsError(e) => e.request_id(),
95            Self::ValidationException(e) => e.request_id(),
96            Self::Unhandled(e) => e.meta.request_id(),
97        }
98    }
99}
100