#[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),
ThrottlingException(crate::types::error::ThrottlingException),
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::ThrottlingException(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::ThrottlingException(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::batch_update_recommendation_resource_exclusion::BatchUpdateRecommendationResourceExclusionError,
R,
>,
> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::batch_update_recommendation_resource_exclusion::BatchUpdateRecommendationResourceExclusionError,
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::batch_update_recommendation_resource_exclusion::BatchUpdateRecommendationResourceExclusionError> for Error {
fn from(err: crate::operation::batch_update_recommendation_resource_exclusion::BatchUpdateRecommendationResourceExclusionError) -> Self {
match err {
crate::operation::batch_update_recommendation_resource_exclusion::BatchUpdateRecommendationResourceExclusionError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
crate::operation::batch_update_recommendation_resource_exclusion::BatchUpdateRecommendationResourceExclusionError::ConflictException(inner) => Error::ConflictException(inner),
crate::operation::batch_update_recommendation_resource_exclusion::BatchUpdateRecommendationResourceExclusionError::InternalServerException(inner) => Error::InternalServerException(inner),
crate::operation::batch_update_recommendation_resource_exclusion::BatchUpdateRecommendationResourceExclusionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
crate::operation::batch_update_recommendation_resource_exclusion::BatchUpdateRecommendationResourceExclusionError::ValidationException(inner) => Error::ValidationException(inner),
crate::operation::batch_update_recommendation_resource_exclusion::BatchUpdateRecommendationResourceExclusionError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R>
From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_organization_recommendation::GetOrganizationRecommendationError, R>>
for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::get_organization_recommendation::GetOrganizationRecommendationError,
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_organization_recommendation::GetOrganizationRecommendationError> for Error {
fn from(err: crate::operation::get_organization_recommendation::GetOrganizationRecommendationError) -> Self {
match err {
crate::operation::get_organization_recommendation::GetOrganizationRecommendationError::AccessDeniedException(inner) => {
Error::AccessDeniedException(inner)
}
crate::operation::get_organization_recommendation::GetOrganizationRecommendationError::InternalServerException(inner) => {
Error::InternalServerException(inner)
}
crate::operation::get_organization_recommendation::GetOrganizationRecommendationError::ResourceNotFoundException(inner) => {
Error::ResourceNotFoundException(inner)
}
crate::operation::get_organization_recommendation::GetOrganizationRecommendationError::ThrottlingException(inner) => {
Error::ThrottlingException(inner)
}
crate::operation::get_organization_recommendation::GetOrganizationRecommendationError::ValidationException(inner) => {
Error::ValidationException(inner)
}
crate::operation::get_organization_recommendation::GetOrganizationRecommendationError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_recommendation::GetRecommendationError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_recommendation::GetRecommendationError, 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_recommendation::GetRecommendationError> for Error {
fn from(err: crate::operation::get_recommendation::GetRecommendationError) -> Self {
match err {
crate::operation::get_recommendation::GetRecommendationError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
crate::operation::get_recommendation::GetRecommendationError::InternalServerException(inner) => Error::InternalServerException(inner),
crate::operation::get_recommendation::GetRecommendationError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
crate::operation::get_recommendation::GetRecommendationError::ThrottlingException(inner) => Error::ThrottlingException(inner),
crate::operation::get_recommendation::GetRecommendationError::ValidationException(inner) => Error::ValidationException(inner),
crate::operation::get_recommendation::GetRecommendationError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_checks::ListChecksError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_checks::ListChecksError, 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_checks::ListChecksError> for Error {
fn from(err: crate::operation::list_checks::ListChecksError) -> Self {
match err {
crate::operation::list_checks::ListChecksError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
crate::operation::list_checks::ListChecksError::InternalServerException(inner) => Error::InternalServerException(inner),
crate::operation::list_checks::ListChecksError::ThrottlingException(inner) => Error::ThrottlingException(inner),
crate::operation::list_checks::ListChecksError::ValidationException(inner) => Error::ValidationException(inner),
crate::operation::list_checks::ListChecksError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R>
From<
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::list_organization_recommendation_accounts::ListOrganizationRecommendationAccountsError,
R,
>,
> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::list_organization_recommendation_accounts::ListOrganizationRecommendationAccountsError,
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_organization_recommendation_accounts::ListOrganizationRecommendationAccountsError> for Error {
fn from(err: crate::operation::list_organization_recommendation_accounts::ListOrganizationRecommendationAccountsError) -> Self {
match err {
crate::operation::list_organization_recommendation_accounts::ListOrganizationRecommendationAccountsError::AccessDeniedException(
inner,
) => Error::AccessDeniedException(inner),
crate::operation::list_organization_recommendation_accounts::ListOrganizationRecommendationAccountsError::InternalServerException(
inner,
) => Error::InternalServerException(inner),
crate::operation::list_organization_recommendation_accounts::ListOrganizationRecommendationAccountsError::ResourceNotFoundException(
inner,
) => Error::ResourceNotFoundException(inner),
crate::operation::list_organization_recommendation_accounts::ListOrganizationRecommendationAccountsError::ThrottlingException(inner) => {
Error::ThrottlingException(inner)
}
crate::operation::list_organization_recommendation_accounts::ListOrganizationRecommendationAccountsError::ValidationException(inner) => {
Error::ValidationException(inner)
}
crate::operation::list_organization_recommendation_accounts::ListOrganizationRecommendationAccountsError::Unhandled(inner) => {
Error::Unhandled(inner)
}
}
}
}
impl<R>
From<
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::list_organization_recommendation_resources::ListOrganizationRecommendationResourcesError,
R,
>,
> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::list_organization_recommendation_resources::ListOrganizationRecommendationResourcesError,
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_organization_recommendation_resources::ListOrganizationRecommendationResourcesError> for Error {
fn from(err: crate::operation::list_organization_recommendation_resources::ListOrganizationRecommendationResourcesError) -> Self {
match err {
crate::operation::list_organization_recommendation_resources::ListOrganizationRecommendationResourcesError::AccessDeniedException(
inner,
) => Error::AccessDeniedException(inner),
crate::operation::list_organization_recommendation_resources::ListOrganizationRecommendationResourcesError::InternalServerException(
inner,
) => Error::InternalServerException(inner),
crate::operation::list_organization_recommendation_resources::ListOrganizationRecommendationResourcesError::ResourceNotFoundException(
inner,
) => Error::ResourceNotFoundException(inner),
crate::operation::list_organization_recommendation_resources::ListOrganizationRecommendationResourcesError::ThrottlingException(
inner,
) => Error::ThrottlingException(inner),
crate::operation::list_organization_recommendation_resources::ListOrganizationRecommendationResourcesError::ValidationException(
inner,
) => Error::ValidationException(inner),
crate::operation::list_organization_recommendation_resources::ListOrganizationRecommendationResourcesError::Unhandled(inner) => {
Error::Unhandled(inner)
}
}
}
}
impl<R>
From<
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::list_organization_recommendations::ListOrganizationRecommendationsError,
R,
>,
> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::list_organization_recommendations::ListOrganizationRecommendationsError,
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_organization_recommendations::ListOrganizationRecommendationsError> for Error {
fn from(err: crate::operation::list_organization_recommendations::ListOrganizationRecommendationsError) -> Self {
match err {
crate::operation::list_organization_recommendations::ListOrganizationRecommendationsError::AccessDeniedException(inner) => {
Error::AccessDeniedException(inner)
}
crate::operation::list_organization_recommendations::ListOrganizationRecommendationsError::InternalServerException(inner) => {
Error::InternalServerException(inner)
}
crate::operation::list_organization_recommendations::ListOrganizationRecommendationsError::ThrottlingException(inner) => {
Error::ThrottlingException(inner)
}
crate::operation::list_organization_recommendations::ListOrganizationRecommendationsError::ValidationException(inner) => {
Error::ValidationException(inner)
}
crate::operation::list_organization_recommendations::ListOrganizationRecommendationsError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_recommendation_resources::ListRecommendationResourcesError, R>>
for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_recommendation_resources::ListRecommendationResourcesError, 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_recommendation_resources::ListRecommendationResourcesError> for Error {
fn from(err: crate::operation::list_recommendation_resources::ListRecommendationResourcesError) -> Self {
match err {
crate::operation::list_recommendation_resources::ListRecommendationResourcesError::AccessDeniedException(inner) => {
Error::AccessDeniedException(inner)
}
crate::operation::list_recommendation_resources::ListRecommendationResourcesError::InternalServerException(inner) => {
Error::InternalServerException(inner)
}
crate::operation::list_recommendation_resources::ListRecommendationResourcesError::ResourceNotFoundException(inner) => {
Error::ResourceNotFoundException(inner)
}
crate::operation::list_recommendation_resources::ListRecommendationResourcesError::ThrottlingException(inner) => {
Error::ThrottlingException(inner)
}
crate::operation::list_recommendation_resources::ListRecommendationResourcesError::ValidationException(inner) => {
Error::ValidationException(inner)
}
crate::operation::list_recommendation_resources::ListRecommendationResourcesError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_recommendations::ListRecommendationsError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_recommendations::ListRecommendationsError, 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_recommendations::ListRecommendationsError> for Error {
fn from(err: crate::operation::list_recommendations::ListRecommendationsError) -> Self {
match err {
crate::operation::list_recommendations::ListRecommendationsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
crate::operation::list_recommendations::ListRecommendationsError::InternalServerException(inner) => Error::InternalServerException(inner),
crate::operation::list_recommendations::ListRecommendationsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
crate::operation::list_recommendations::ListRecommendationsError::ValidationException(inner) => Error::ValidationException(inner),
crate::operation::list_recommendations::ListRecommendationsError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R>
From<
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::update_organization_recommendation_lifecycle::UpdateOrganizationRecommendationLifecycleError,
R,
>,
> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::update_organization_recommendation_lifecycle::UpdateOrganizationRecommendationLifecycleError,
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_organization_recommendation_lifecycle::UpdateOrganizationRecommendationLifecycleError> for Error {
fn from(err: crate::operation::update_organization_recommendation_lifecycle::UpdateOrganizationRecommendationLifecycleError) -> Self {
match err {
crate::operation::update_organization_recommendation_lifecycle::UpdateOrganizationRecommendationLifecycleError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
crate::operation::update_organization_recommendation_lifecycle::UpdateOrganizationRecommendationLifecycleError::ConflictException(inner) => Error::ConflictException(inner),
crate::operation::update_organization_recommendation_lifecycle::UpdateOrganizationRecommendationLifecycleError::InternalServerException(inner) => Error::InternalServerException(inner),
crate::operation::update_organization_recommendation_lifecycle::UpdateOrganizationRecommendationLifecycleError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
crate::operation::update_organization_recommendation_lifecycle::UpdateOrganizationRecommendationLifecycleError::ThrottlingException(inner) => Error::ThrottlingException(inner),
crate::operation::update_organization_recommendation_lifecycle::UpdateOrganizationRecommendationLifecycleError::ValidationException(inner) => Error::ValidationException(inner),
crate::operation::update_organization_recommendation_lifecycle::UpdateOrganizationRecommendationLifecycleError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R>
From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_recommendation_lifecycle::UpdateRecommendationLifecycleError, R>>
for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::update_recommendation_lifecycle::UpdateRecommendationLifecycleError,
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_recommendation_lifecycle::UpdateRecommendationLifecycleError> for Error {
fn from(err: crate::operation::update_recommendation_lifecycle::UpdateRecommendationLifecycleError) -> Self {
match err {
crate::operation::update_recommendation_lifecycle::UpdateRecommendationLifecycleError::AccessDeniedException(inner) => {
Error::AccessDeniedException(inner)
}
crate::operation::update_recommendation_lifecycle::UpdateRecommendationLifecycleError::ConflictException(inner) => {
Error::ConflictException(inner)
}
crate::operation::update_recommendation_lifecycle::UpdateRecommendationLifecycleError::InternalServerException(inner) => {
Error::InternalServerException(inner)
}
crate::operation::update_recommendation_lifecycle::UpdateRecommendationLifecycleError::ResourceNotFoundException(inner) => {
Error::ResourceNotFoundException(inner)
}
crate::operation::update_recommendation_lifecycle::UpdateRecommendationLifecycleError::ThrottlingException(inner) => {
Error::ThrottlingException(inner)
}
crate::operation::update_recommendation_lifecycle::UpdateRecommendationLifecycleError::ValidationException(inner) => {
Error::ValidationException(inner)
}
crate::operation::update_recommendation_lifecycle::UpdateRecommendationLifecycleError::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::ThrottlingException(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::ThrottlingException(e) => e.request_id(),
Self::ValidationException(e) => e.request_id(),
Self::Unhandled(e) => e.meta.request_id(),
}
}
}