#[non_exhaustive]
#[derive(::std::fmt::Debug)]
pub enum Error {
ConflictException(crate::types::error::ConflictException),
InternalFailureException(crate::types::error::InternalFailureException),
InvalidRequestException(crate::types::error::InvalidRequestException),
MethodNotAllowedException(crate::types::error::MethodNotAllowedException),
RequestEntityTooLargeException(crate::types::error::RequestEntityTooLargeException),
ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
ThrottlingException(crate::types::error::ThrottlingException),
UnauthorizedException(crate::types::error::UnauthorizedException),
UnsupportedDocumentEncodingException(crate::types::error::UnsupportedDocumentEncodingException),
#[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::ConflictException(inner) => inner.fmt(f),
Error::InternalFailureException(inner) => inner.fmt(f),
Error::InvalidRequestException(inner) => inner.fmt(f),
Error::MethodNotAllowedException(inner) => inner.fmt(f),
Error::RequestEntityTooLargeException(inner) => inner.fmt(f),
Error::ResourceNotFoundException(inner) => inner.fmt(f),
Error::ServiceUnavailableException(inner) => inner.fmt(f),
Error::ThrottlingException(inner) => inner.fmt(f),
Error::UnauthorizedException(inner) => inner.fmt(f),
Error::UnsupportedDocumentEncodingException(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::ConflictException(inner) => inner.meta(),
Self::InternalFailureException(inner) => inner.meta(),
Self::InvalidRequestException(inner) => inner.meta(),
Self::MethodNotAllowedException(inner) => inner.meta(),
Self::RequestEntityTooLargeException(inner) => inner.meta(),
Self::ResourceNotFoundException(inner) => inner.meta(),
Self::ServiceUnavailableException(inner) => inner.meta(),
Self::ThrottlingException(inner) => inner.meta(),
Self::UnauthorizedException(inner) => inner.meta(),
Self::UnsupportedDocumentEncodingException(inner) => inner.meta(),
Self::Unhandled(inner) => &inner.meta,
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_thing_shadow::DeleteThingShadowError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_thing_shadow::DeleteThingShadowError, 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_thing_shadow::DeleteThingShadowError> for Error {
fn from(err: crate::operation::delete_thing_shadow::DeleteThingShadowError) -> Self {
match err {
crate::operation::delete_thing_shadow::DeleteThingShadowError::InternalFailureException(inner) => Error::InternalFailureException(inner),
crate::operation::delete_thing_shadow::DeleteThingShadowError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
crate::operation::delete_thing_shadow::DeleteThingShadowError::MethodNotAllowedException(inner) => {
Error::MethodNotAllowedException(inner)
}
crate::operation::delete_thing_shadow::DeleteThingShadowError::ResourceNotFoundException(inner) => {
Error::ResourceNotFoundException(inner)
}
crate::operation::delete_thing_shadow::DeleteThingShadowError::ServiceUnavailableException(inner) => {
Error::ServiceUnavailableException(inner)
}
crate::operation::delete_thing_shadow::DeleteThingShadowError::ThrottlingException(inner) => Error::ThrottlingException(inner),
crate::operation::delete_thing_shadow::DeleteThingShadowError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
crate::operation::delete_thing_shadow::DeleteThingShadowError::UnsupportedDocumentEncodingException(inner) => {
Error::UnsupportedDocumentEncodingException(inner)
}
crate::operation::delete_thing_shadow::DeleteThingShadowError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_retained_message::GetRetainedMessageError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_retained_message::GetRetainedMessageError, 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_retained_message::GetRetainedMessageError> for Error {
fn from(err: crate::operation::get_retained_message::GetRetainedMessageError) -> Self {
match err {
crate::operation::get_retained_message::GetRetainedMessageError::InternalFailureException(inner) => {
Error::InternalFailureException(inner)
}
crate::operation::get_retained_message::GetRetainedMessageError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
crate::operation::get_retained_message::GetRetainedMessageError::MethodNotAllowedException(inner) => {
Error::MethodNotAllowedException(inner)
}
crate::operation::get_retained_message::GetRetainedMessageError::ResourceNotFoundException(inner) => {
Error::ResourceNotFoundException(inner)
}
crate::operation::get_retained_message::GetRetainedMessageError::ServiceUnavailableException(inner) => {
Error::ServiceUnavailableException(inner)
}
crate::operation::get_retained_message::GetRetainedMessageError::ThrottlingException(inner) => Error::ThrottlingException(inner),
crate::operation::get_retained_message::GetRetainedMessageError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
crate::operation::get_retained_message::GetRetainedMessageError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_thing_shadow::GetThingShadowError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_thing_shadow::GetThingShadowError, 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_thing_shadow::GetThingShadowError> for Error {
fn from(err: crate::operation::get_thing_shadow::GetThingShadowError) -> Self {
match err {
crate::operation::get_thing_shadow::GetThingShadowError::InternalFailureException(inner) => Error::InternalFailureException(inner),
crate::operation::get_thing_shadow::GetThingShadowError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
crate::operation::get_thing_shadow::GetThingShadowError::MethodNotAllowedException(inner) => Error::MethodNotAllowedException(inner),
crate::operation::get_thing_shadow::GetThingShadowError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
crate::operation::get_thing_shadow::GetThingShadowError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
crate::operation::get_thing_shadow::GetThingShadowError::ThrottlingException(inner) => Error::ThrottlingException(inner),
crate::operation::get_thing_shadow::GetThingShadowError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
crate::operation::get_thing_shadow::GetThingShadowError::UnsupportedDocumentEncodingException(inner) => {
Error::UnsupportedDocumentEncodingException(inner)
}
crate::operation::get_thing_shadow::GetThingShadowError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError, R>>
for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError, 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_named_shadows_for_thing::ListNamedShadowsForThingError> for Error {
fn from(err: crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError) -> Self {
match err {
crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::InternalFailureException(inner) => {
Error::InternalFailureException(inner)
}
crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::InvalidRequestException(inner) => {
Error::InvalidRequestException(inner)
}
crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::MethodNotAllowedException(inner) => {
Error::MethodNotAllowedException(inner)
}
crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::ResourceNotFoundException(inner) => {
Error::ResourceNotFoundException(inner)
}
crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::ServiceUnavailableException(inner) => {
Error::ServiceUnavailableException(inner)
}
crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::ThrottlingException(inner) => {
Error::ThrottlingException(inner)
}
crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::UnauthorizedException(inner) => {
Error::UnauthorizedException(inner)
}
crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_retained_messages::ListRetainedMessagesError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_retained_messages::ListRetainedMessagesError, 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_retained_messages::ListRetainedMessagesError> for Error {
fn from(err: crate::operation::list_retained_messages::ListRetainedMessagesError) -> Self {
match err {
crate::operation::list_retained_messages::ListRetainedMessagesError::InternalFailureException(inner) => {
Error::InternalFailureException(inner)
}
crate::operation::list_retained_messages::ListRetainedMessagesError::InvalidRequestException(inner) => {
Error::InvalidRequestException(inner)
}
crate::operation::list_retained_messages::ListRetainedMessagesError::MethodNotAllowedException(inner) => {
Error::MethodNotAllowedException(inner)
}
crate::operation::list_retained_messages::ListRetainedMessagesError::ServiceUnavailableException(inner) => {
Error::ServiceUnavailableException(inner)
}
crate::operation::list_retained_messages::ListRetainedMessagesError::ThrottlingException(inner) => Error::ThrottlingException(inner),
crate::operation::list_retained_messages::ListRetainedMessagesError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
crate::operation::list_retained_messages::ListRetainedMessagesError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::publish::PublishError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::publish::PublishError, 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::publish::PublishError> for Error {
fn from(err: crate::operation::publish::PublishError) -> Self {
match err {
crate::operation::publish::PublishError::InternalFailureException(inner) => Error::InternalFailureException(inner),
crate::operation::publish::PublishError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
crate::operation::publish::PublishError::MethodNotAllowedException(inner) => Error::MethodNotAllowedException(inner),
crate::operation::publish::PublishError::ThrottlingException(inner) => Error::ThrottlingException(inner),
crate::operation::publish::PublishError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
crate::operation::publish::PublishError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_thing_shadow::UpdateThingShadowError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_thing_shadow::UpdateThingShadowError, 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::update_thing_shadow::UpdateThingShadowError> for Error {
fn from(err: crate::operation::update_thing_shadow::UpdateThingShadowError) -> Self {
match err {
crate::operation::update_thing_shadow::UpdateThingShadowError::ConflictException(inner) => Error::ConflictException(inner),
crate::operation::update_thing_shadow::UpdateThingShadowError::InternalFailureException(inner) => Error::InternalFailureException(inner),
crate::operation::update_thing_shadow::UpdateThingShadowError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
crate::operation::update_thing_shadow::UpdateThingShadowError::MethodNotAllowedException(inner) => {
Error::MethodNotAllowedException(inner)
}
crate::operation::update_thing_shadow::UpdateThingShadowError::RequestEntityTooLargeException(inner) => {
Error::RequestEntityTooLargeException(inner)
}
crate::operation::update_thing_shadow::UpdateThingShadowError::ServiceUnavailableException(inner) => {
Error::ServiceUnavailableException(inner)
}
crate::operation::update_thing_shadow::UpdateThingShadowError::ThrottlingException(inner) => Error::ThrottlingException(inner),
crate::operation::update_thing_shadow::UpdateThingShadowError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
crate::operation::update_thing_shadow::UpdateThingShadowError::UnsupportedDocumentEncodingException(inner) => {
Error::UnsupportedDocumentEncodingException(inner)
}
crate::operation::update_thing_shadow::UpdateThingShadowError::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::ConflictException(inner) => inner.source(),
Error::InternalFailureException(inner) => inner.source(),
Error::InvalidRequestException(inner) => inner.source(),
Error::MethodNotAllowedException(inner) => inner.source(),
Error::RequestEntityTooLargeException(inner) => inner.source(),
Error::ResourceNotFoundException(inner) => inner.source(),
Error::ServiceUnavailableException(inner) => inner.source(),
Error::ThrottlingException(inner) => inner.source(),
Error::UnauthorizedException(inner) => inner.source(),
Error::UnsupportedDocumentEncodingException(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::ConflictException(e) => e.request_id(),
Self::InternalFailureException(e) => e.request_id(),
Self::InvalidRequestException(e) => e.request_id(),
Self::MethodNotAllowedException(e) => e.request_id(),
Self::RequestEntityTooLargeException(e) => e.request_id(),
Self::ResourceNotFoundException(e) => e.request_id(),
Self::ServiceUnavailableException(e) => e.request_id(),
Self::ThrottlingException(e) => e.request_id(),
Self::UnauthorizedException(e) => e.request_id(),
Self::UnsupportedDocumentEncodingException(e) => e.request_id(),
Self::Unhandled(e) => e.meta.request_id(),
}
}
}