#[non_exhaustive]
#[derive(::std::fmt::Debug)]
pub enum Error {
AccessDeniedException(crate::types::error::AccessDeniedException),
ConflictException(crate::types::error::ConflictException),
InternalServerException(crate::types::error::InternalServerException),
ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
TooManyRequestsException(crate::types::error::TooManyRequestsException),
ValidationException(crate::types::error::ValidationException),
#[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
variable wildcard pattern and check `.code()`:
\
`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
\
See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
Unhandled(crate::error::sealed_unhandled::Unhandled),
}
impl ::std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Error::AccessDeniedException(inner) => inner.fmt(f),
Error::ConflictException(inner) => inner.fmt(f),
Error::InternalServerException(inner) => inner.fmt(f),
Error::ResourceNotFoundException(inner) => inner.fmt(f),
Error::TooManyRequestsException(inner) => inner.fmt(f),
Error::ValidationException(inner) => inner.fmt(f),
Error::Unhandled(_) => {
if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
write!(f, "unhandled error ({code})")
} else {
f.write_str("unhandled error")
}
}
}
}
}
impl From<::aws_smithy_types::error::operation::BuildError> for Error {
fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
source: value.into(),
meta: ::std::default::Default::default(),
})
}
}
impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
match self {
Self::AccessDeniedException(inner) => inner.meta(),
Self::ConflictException(inner) => inner.meta(),
Self::InternalServerException(inner) => inner.meta(),
Self::ResourceNotFoundException(inner) => inner.meta(),
Self::TooManyRequestsException(inner) => inner.meta(),
Self::ValidationException(inner) => inner.meta(),
Self::Unhandled(inner) => &inner.meta,
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::accept_primary_email_update::AcceptPrimaryEmailUpdateError, R>>
for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::accept_primary_email_update::AcceptPrimaryEmailUpdateError, R>,
) -> Self {
match err {
::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
_ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
source: err.into(),
}),
}
}
}
impl From<crate::operation::accept_primary_email_update::AcceptPrimaryEmailUpdateError> for Error {
fn from(err: crate::operation::accept_primary_email_update::AcceptPrimaryEmailUpdateError) -> Self {
match err {
crate::operation::accept_primary_email_update::AcceptPrimaryEmailUpdateError::AccessDeniedException(inner) => {
Error::AccessDeniedException(inner)
}
crate::operation::accept_primary_email_update::AcceptPrimaryEmailUpdateError::ConflictException(inner) => Error::ConflictException(inner),
crate::operation::accept_primary_email_update::AcceptPrimaryEmailUpdateError::InternalServerException(inner) => {
Error::InternalServerException(inner)
}
crate::operation::accept_primary_email_update::AcceptPrimaryEmailUpdateError::ResourceNotFoundException(inner) => {
Error::ResourceNotFoundException(inner)
}
crate::operation::accept_primary_email_update::AcceptPrimaryEmailUpdateError::TooManyRequestsException(inner) => {
Error::TooManyRequestsException(inner)
}
crate::operation::accept_primary_email_update::AcceptPrimaryEmailUpdateError::ValidationException(inner) => {
Error::ValidationException(inner)
}
crate::operation::accept_primary_email_update::AcceptPrimaryEmailUpdateError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_alternate_contact::DeleteAlternateContactError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_alternate_contact::DeleteAlternateContactError, R>,
) -> Self {
match err {
::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
_ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
source: err.into(),
}),
}
}
}
impl From<crate::operation::delete_alternate_contact::DeleteAlternateContactError> for Error {
fn from(err: crate::operation::delete_alternate_contact::DeleteAlternateContactError) -> Self {
match err {
crate::operation::delete_alternate_contact::DeleteAlternateContactError::AccessDeniedException(inner) => {
Error::AccessDeniedException(inner)
}
crate::operation::delete_alternate_contact::DeleteAlternateContactError::InternalServerException(inner) => {
Error::InternalServerException(inner)
}
crate::operation::delete_alternate_contact::DeleteAlternateContactError::ResourceNotFoundException(inner) => {
Error::ResourceNotFoundException(inner)
}
crate::operation::delete_alternate_contact::DeleteAlternateContactError::TooManyRequestsException(inner) => {
Error::TooManyRequestsException(inner)
}
crate::operation::delete_alternate_contact::DeleteAlternateContactError::ValidationException(inner) => Error::ValidationException(inner),
crate::operation::delete_alternate_contact::DeleteAlternateContactError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::disable_region::DisableRegionError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::disable_region::DisableRegionError, R>) -> Self {
match err {
::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
_ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
source: err.into(),
}),
}
}
}
impl From<crate::operation::disable_region::DisableRegionError> for Error {
fn from(err: crate::operation::disable_region::DisableRegionError) -> Self {
match err {
crate::operation::disable_region::DisableRegionError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
crate::operation::disable_region::DisableRegionError::ConflictException(inner) => Error::ConflictException(inner),
crate::operation::disable_region::DisableRegionError::InternalServerException(inner) => Error::InternalServerException(inner),
crate::operation::disable_region::DisableRegionError::TooManyRequestsException(inner) => Error::TooManyRequestsException(inner),
crate::operation::disable_region::DisableRegionError::ValidationException(inner) => Error::ValidationException(inner),
crate::operation::disable_region::DisableRegionError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::enable_region::EnableRegionError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::enable_region::EnableRegionError, R>) -> Self {
match err {
::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
_ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
source: err.into(),
}),
}
}
}
impl From<crate::operation::enable_region::EnableRegionError> for Error {
fn from(err: crate::operation::enable_region::EnableRegionError) -> Self {
match err {
crate::operation::enable_region::EnableRegionError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
crate::operation::enable_region::EnableRegionError::ConflictException(inner) => Error::ConflictException(inner),
crate::operation::enable_region::EnableRegionError::InternalServerException(inner) => Error::InternalServerException(inner),
crate::operation::enable_region::EnableRegionError::TooManyRequestsException(inner) => Error::TooManyRequestsException(inner),
crate::operation::enable_region::EnableRegionError::ValidationException(inner) => Error::ValidationException(inner),
crate::operation::enable_region::EnableRegionError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_alternate_contact::GetAlternateContactError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_alternate_contact::GetAlternateContactError, R>) -> Self {
match err {
::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
_ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
source: err.into(),
}),
}
}
}
impl From<crate::operation::get_alternate_contact::GetAlternateContactError> for Error {
fn from(err: crate::operation::get_alternate_contact::GetAlternateContactError) -> Self {
match err {
crate::operation::get_alternate_contact::GetAlternateContactError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
crate::operation::get_alternate_contact::GetAlternateContactError::InternalServerException(inner) => {
Error::InternalServerException(inner)
}
crate::operation::get_alternate_contact::GetAlternateContactError::ResourceNotFoundException(inner) => {
Error::ResourceNotFoundException(inner)
}
crate::operation::get_alternate_contact::GetAlternateContactError::TooManyRequestsException(inner) => {
Error::TooManyRequestsException(inner)
}
crate::operation::get_alternate_contact::GetAlternateContactError::ValidationException(inner) => Error::ValidationException(inner),
crate::operation::get_alternate_contact::GetAlternateContactError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_contact_information::GetContactInformationError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_contact_information::GetContactInformationError, R>,
) -> Self {
match err {
::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
_ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
source: err.into(),
}),
}
}
}
impl From<crate::operation::get_contact_information::GetContactInformationError> for Error {
fn from(err: crate::operation::get_contact_information::GetContactInformationError) -> Self {
match err {
crate::operation::get_contact_information::GetContactInformationError::AccessDeniedException(inner) => {
Error::AccessDeniedException(inner)
}
crate::operation::get_contact_information::GetContactInformationError::InternalServerException(inner) => {
Error::InternalServerException(inner)
}
crate::operation::get_contact_information::GetContactInformationError::ResourceNotFoundException(inner) => {
Error::ResourceNotFoundException(inner)
}
crate::operation::get_contact_information::GetContactInformationError::TooManyRequestsException(inner) => {
Error::TooManyRequestsException(inner)
}
crate::operation::get_contact_information::GetContactInformationError::ValidationException(inner) => Error::ValidationException(inner),
crate::operation::get_contact_information::GetContactInformationError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_primary_email::GetPrimaryEmailError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_primary_email::GetPrimaryEmailError, R>) -> Self {
match err {
::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
_ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
source: err.into(),
}),
}
}
}
impl From<crate::operation::get_primary_email::GetPrimaryEmailError> for Error {
fn from(err: crate::operation::get_primary_email::GetPrimaryEmailError) -> Self {
match err {
crate::operation::get_primary_email::GetPrimaryEmailError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
crate::operation::get_primary_email::GetPrimaryEmailError::InternalServerException(inner) => Error::InternalServerException(inner),
crate::operation::get_primary_email::GetPrimaryEmailError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
crate::operation::get_primary_email::GetPrimaryEmailError::TooManyRequestsException(inner) => Error::TooManyRequestsException(inner),
crate::operation::get_primary_email::GetPrimaryEmailError::ValidationException(inner) => Error::ValidationException(inner),
crate::operation::get_primary_email::GetPrimaryEmailError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_region_opt_status::GetRegionOptStatusError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_region_opt_status::GetRegionOptStatusError, R>) -> Self {
match err {
::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
_ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
source: err.into(),
}),
}
}
}
impl From<crate::operation::get_region_opt_status::GetRegionOptStatusError> for Error {
fn from(err: crate::operation::get_region_opt_status::GetRegionOptStatusError) -> Self {
match err {
crate::operation::get_region_opt_status::GetRegionOptStatusError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
crate::operation::get_region_opt_status::GetRegionOptStatusError::InternalServerException(inner) => Error::InternalServerException(inner),
crate::operation::get_region_opt_status::GetRegionOptStatusError::TooManyRequestsException(inner) => {
Error::TooManyRequestsException(inner)
}
crate::operation::get_region_opt_status::GetRegionOptStatusError::ValidationException(inner) => Error::ValidationException(inner),
crate::operation::get_region_opt_status::GetRegionOptStatusError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_regions::ListRegionsError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_regions::ListRegionsError, R>) -> Self {
match err {
::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
_ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
source: err.into(),
}),
}
}
}
impl From<crate::operation::list_regions::ListRegionsError> for Error {
fn from(err: crate::operation::list_regions::ListRegionsError) -> Self {
match err {
crate::operation::list_regions::ListRegionsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
crate::operation::list_regions::ListRegionsError::InternalServerException(inner) => Error::InternalServerException(inner),
crate::operation::list_regions::ListRegionsError::TooManyRequestsException(inner) => Error::TooManyRequestsException(inner),
crate::operation::list_regions::ListRegionsError::ValidationException(inner) => Error::ValidationException(inner),
crate::operation::list_regions::ListRegionsError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_alternate_contact::PutAlternateContactError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_alternate_contact::PutAlternateContactError, R>) -> Self {
match err {
::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
_ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
source: err.into(),
}),
}
}
}
impl From<crate::operation::put_alternate_contact::PutAlternateContactError> for Error {
fn from(err: crate::operation::put_alternate_contact::PutAlternateContactError) -> Self {
match err {
crate::operation::put_alternate_contact::PutAlternateContactError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
crate::operation::put_alternate_contact::PutAlternateContactError::InternalServerException(inner) => {
Error::InternalServerException(inner)
}
crate::operation::put_alternate_contact::PutAlternateContactError::TooManyRequestsException(inner) => {
Error::TooManyRequestsException(inner)
}
crate::operation::put_alternate_contact::PutAlternateContactError::ValidationException(inner) => Error::ValidationException(inner),
crate::operation::put_alternate_contact::PutAlternateContactError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_contact_information::PutContactInformationError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_contact_information::PutContactInformationError, R>,
) -> Self {
match err {
::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
_ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
source: err.into(),
}),
}
}
}
impl From<crate::operation::put_contact_information::PutContactInformationError> for Error {
fn from(err: crate::operation::put_contact_information::PutContactInformationError) -> Self {
match err {
crate::operation::put_contact_information::PutContactInformationError::AccessDeniedException(inner) => {
Error::AccessDeniedException(inner)
}
crate::operation::put_contact_information::PutContactInformationError::InternalServerException(inner) => {
Error::InternalServerException(inner)
}
crate::operation::put_contact_information::PutContactInformationError::TooManyRequestsException(inner) => {
Error::TooManyRequestsException(inner)
}
crate::operation::put_contact_information::PutContactInformationError::ValidationException(inner) => Error::ValidationException(inner),
crate::operation::put_contact_information::PutContactInformationError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_primary_email_update::StartPrimaryEmailUpdateError, R>>
for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_primary_email_update::StartPrimaryEmailUpdateError, R>,
) -> Self {
match err {
::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
_ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
source: err.into(),
}),
}
}
}
impl From<crate::operation::start_primary_email_update::StartPrimaryEmailUpdateError> for Error {
fn from(err: crate::operation::start_primary_email_update::StartPrimaryEmailUpdateError) -> Self {
match err {
crate::operation::start_primary_email_update::StartPrimaryEmailUpdateError::AccessDeniedException(inner) => {
Error::AccessDeniedException(inner)
}
crate::operation::start_primary_email_update::StartPrimaryEmailUpdateError::ConflictException(inner) => Error::ConflictException(inner),
crate::operation::start_primary_email_update::StartPrimaryEmailUpdateError::InternalServerException(inner) => {
Error::InternalServerException(inner)
}
crate::operation::start_primary_email_update::StartPrimaryEmailUpdateError::ResourceNotFoundException(inner) => {
Error::ResourceNotFoundException(inner)
}
crate::operation::start_primary_email_update::StartPrimaryEmailUpdateError::TooManyRequestsException(inner) => {
Error::TooManyRequestsException(inner)
}
crate::operation::start_primary_email_update::StartPrimaryEmailUpdateError::ValidationException(inner) => {
Error::ValidationException(inner)
}
crate::operation::start_primary_email_update::StartPrimaryEmailUpdateError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl ::std::error::Error for Error {
fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
match self {
Error::AccessDeniedException(inner) => inner.source(),
Error::ConflictException(inner) => inner.source(),
Error::InternalServerException(inner) => inner.source(),
Error::ResourceNotFoundException(inner) => inner.source(),
Error::TooManyRequestsException(inner) => inner.source(),
Error::ValidationException(inner) => inner.source(),
Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
}
}
}
impl ::aws_types::request_id::RequestId for Error {
fn request_id(&self) -> Option<&str> {
match self {
Self::AccessDeniedException(e) => e.request_id(),
Self::ConflictException(e) => e.request_id(),
Self::InternalServerException(e) => e.request_id(),
Self::ResourceNotFoundException(e) => e.request_id(),
Self::TooManyRequestsException(e) => e.request_id(),
Self::ValidationException(e) => e.request_id(),
Self::Unhandled(e) => e.meta.request_id(),
}
}
}