#[non_exhaustive]
#[derive(::std::fmt::Debug)]
pub enum Error {
InternalServiceError(crate::types::error::InternalServiceError),
InvalidArgumentException(crate::types::error::InvalidArgumentException),
NotAuthorizedException(crate::types::error::NotAuthorizedException),
#[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::InternalServiceError(inner) => inner.fmt(f),
Error::InvalidArgumentException(inner) => inner.fmt(f),
Error::NotAuthorizedException(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::InternalServiceError(inner) => inner.meta(),
Self::InvalidArgumentException(inner) => inner.meta(),
Self::NotAuthorizedException(inner) => inner.meta(),
Self::Unhandled(inner) => &inner.meta,
}
}
}
impl<R>
From<
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::create_performance_analysis_report::CreatePerformanceAnalysisReportError,
R,
>,
> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::create_performance_analysis_report::CreatePerformanceAnalysisReportError,
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::create_performance_analysis_report::CreatePerformanceAnalysisReportError> for Error {
fn from(err: crate::operation::create_performance_analysis_report::CreatePerformanceAnalysisReportError) -> Self {
match err {
crate::operation::create_performance_analysis_report::CreatePerformanceAnalysisReportError::InternalServiceError(inner) => {
Error::InternalServiceError(inner)
}
crate::operation::create_performance_analysis_report::CreatePerformanceAnalysisReportError::InvalidArgumentException(inner) => {
Error::InvalidArgumentException(inner)
}
crate::operation::create_performance_analysis_report::CreatePerformanceAnalysisReportError::NotAuthorizedException(inner) => {
Error::NotAuthorizedException(inner)
}
crate::operation::create_performance_analysis_report::CreatePerformanceAnalysisReportError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R>
From<
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::delete_performance_analysis_report::DeletePerformanceAnalysisReportError,
R,
>,
> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::delete_performance_analysis_report::DeletePerformanceAnalysisReportError,
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_performance_analysis_report::DeletePerformanceAnalysisReportError> for Error {
fn from(err: crate::operation::delete_performance_analysis_report::DeletePerformanceAnalysisReportError) -> Self {
match err {
crate::operation::delete_performance_analysis_report::DeletePerformanceAnalysisReportError::InternalServiceError(inner) => {
Error::InternalServiceError(inner)
}
crate::operation::delete_performance_analysis_report::DeletePerformanceAnalysisReportError::InvalidArgumentException(inner) => {
Error::InvalidArgumentException(inner)
}
crate::operation::delete_performance_analysis_report::DeletePerformanceAnalysisReportError::NotAuthorizedException(inner) => {
Error::NotAuthorizedException(inner)
}
crate::operation::delete_performance_analysis_report::DeletePerformanceAnalysisReportError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_dimension_keys::DescribeDimensionKeysError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_dimension_keys::DescribeDimensionKeysError, 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::describe_dimension_keys::DescribeDimensionKeysError> for Error {
fn from(err: crate::operation::describe_dimension_keys::DescribeDimensionKeysError) -> Self {
match err {
crate::operation::describe_dimension_keys::DescribeDimensionKeysError::InternalServiceError(inner) => Error::InternalServiceError(inner),
crate::operation::describe_dimension_keys::DescribeDimensionKeysError::InvalidArgumentException(inner) => {
Error::InvalidArgumentException(inner)
}
crate::operation::describe_dimension_keys::DescribeDimensionKeysError::NotAuthorizedException(inner) => {
Error::NotAuthorizedException(inner)
}
crate::operation::describe_dimension_keys::DescribeDimensionKeysError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_dimension_key_details::GetDimensionKeyDetailsError, R>>
for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_dimension_key_details::GetDimensionKeyDetailsError, 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_dimension_key_details::GetDimensionKeyDetailsError> for Error {
fn from(err: crate::operation::get_dimension_key_details::GetDimensionKeyDetailsError) -> Self {
match err {
crate::operation::get_dimension_key_details::GetDimensionKeyDetailsError::InternalServiceError(inner) => {
Error::InternalServiceError(inner)
}
crate::operation::get_dimension_key_details::GetDimensionKeyDetailsError::InvalidArgumentException(inner) => {
Error::InvalidArgumentException(inner)
}
crate::operation::get_dimension_key_details::GetDimensionKeyDetailsError::NotAuthorizedException(inner) => {
Error::NotAuthorizedException(inner)
}
crate::operation::get_dimension_key_details::GetDimensionKeyDetailsError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R>
From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_performance_analysis_report::GetPerformanceAnalysisReportError, R>>
for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::get_performance_analysis_report::GetPerformanceAnalysisReportError,
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_performance_analysis_report::GetPerformanceAnalysisReportError> for Error {
fn from(err: crate::operation::get_performance_analysis_report::GetPerformanceAnalysisReportError) -> Self {
match err {
crate::operation::get_performance_analysis_report::GetPerformanceAnalysisReportError::InternalServiceError(inner) => {
Error::InternalServiceError(inner)
}
crate::operation::get_performance_analysis_report::GetPerformanceAnalysisReportError::InvalidArgumentException(inner) => {
Error::InvalidArgumentException(inner)
}
crate::operation::get_performance_analysis_report::GetPerformanceAnalysisReportError::NotAuthorizedException(inner) => {
Error::NotAuthorizedException(inner)
}
crate::operation::get_performance_analysis_report::GetPerformanceAnalysisReportError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_resource_metadata::GetResourceMetadataError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_resource_metadata::GetResourceMetadataError, 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_resource_metadata::GetResourceMetadataError> for Error {
fn from(err: crate::operation::get_resource_metadata::GetResourceMetadataError) -> Self {
match err {
crate::operation::get_resource_metadata::GetResourceMetadataError::InternalServiceError(inner) => Error::InternalServiceError(inner),
crate::operation::get_resource_metadata::GetResourceMetadataError::InvalidArgumentException(inner) => {
Error::InvalidArgumentException(inner)
}
crate::operation::get_resource_metadata::GetResourceMetadataError::NotAuthorizedException(inner) => Error::NotAuthorizedException(inner),
crate::operation::get_resource_metadata::GetResourceMetadataError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_resource_metrics::GetResourceMetricsError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_resource_metrics::GetResourceMetricsError, 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_resource_metrics::GetResourceMetricsError> for Error {
fn from(err: crate::operation::get_resource_metrics::GetResourceMetricsError) -> Self {
match err {
crate::operation::get_resource_metrics::GetResourceMetricsError::InternalServiceError(inner) => Error::InternalServiceError(inner),
crate::operation::get_resource_metrics::GetResourceMetricsError::InvalidArgumentException(inner) => {
Error::InvalidArgumentException(inner)
}
crate::operation::get_resource_metrics::GetResourceMetricsError::NotAuthorizedException(inner) => Error::NotAuthorizedException(inner),
crate::operation::get_resource_metrics::GetResourceMetricsError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R>
From<
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::list_available_resource_dimensions::ListAvailableResourceDimensionsError,
R,
>,
> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::list_available_resource_dimensions::ListAvailableResourceDimensionsError,
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_available_resource_dimensions::ListAvailableResourceDimensionsError> for Error {
fn from(err: crate::operation::list_available_resource_dimensions::ListAvailableResourceDimensionsError) -> Self {
match err {
crate::operation::list_available_resource_dimensions::ListAvailableResourceDimensionsError::InternalServiceError(inner) => {
Error::InternalServiceError(inner)
}
crate::operation::list_available_resource_dimensions::ListAvailableResourceDimensionsError::InvalidArgumentException(inner) => {
Error::InvalidArgumentException(inner)
}
crate::operation::list_available_resource_dimensions::ListAvailableResourceDimensionsError::NotAuthorizedException(inner) => {
Error::NotAuthorizedException(inner)
}
crate::operation::list_available_resource_dimensions::ListAvailableResourceDimensionsError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R>
From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_available_resource_metrics::ListAvailableResourceMetricsError, R>>
for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::list_available_resource_metrics::ListAvailableResourceMetricsError,
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_available_resource_metrics::ListAvailableResourceMetricsError> for Error {
fn from(err: crate::operation::list_available_resource_metrics::ListAvailableResourceMetricsError) -> Self {
match err {
crate::operation::list_available_resource_metrics::ListAvailableResourceMetricsError::InternalServiceError(inner) => {
Error::InternalServiceError(inner)
}
crate::operation::list_available_resource_metrics::ListAvailableResourceMetricsError::InvalidArgumentException(inner) => {
Error::InvalidArgumentException(inner)
}
crate::operation::list_available_resource_metrics::ListAvailableResourceMetricsError::NotAuthorizedException(inner) => {
Error::NotAuthorizedException(inner)
}
crate::operation::list_available_resource_metrics::ListAvailableResourceMetricsError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R>
From<
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::list_performance_analysis_reports::ListPerformanceAnalysisReportsError,
R,
>,
> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: ::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::list_performance_analysis_reports::ListPerformanceAnalysisReportsError,
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_performance_analysis_reports::ListPerformanceAnalysisReportsError> for Error {
fn from(err: crate::operation::list_performance_analysis_reports::ListPerformanceAnalysisReportsError) -> Self {
match err {
crate::operation::list_performance_analysis_reports::ListPerformanceAnalysisReportsError::InternalServiceError(inner) => {
Error::InternalServiceError(inner)
}
crate::operation::list_performance_analysis_reports::ListPerformanceAnalysisReportsError::InvalidArgumentException(inner) => {
Error::InvalidArgumentException(inner)
}
crate::operation::list_performance_analysis_reports::ListPerformanceAnalysisReportsError::NotAuthorizedException(inner) => {
Error::NotAuthorizedException(inner)
}
crate::operation::list_performance_analysis_reports::ListPerformanceAnalysisReportsError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, 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_tags_for_resource::ListTagsForResourceError> for Error {
fn from(err: crate::operation::list_tags_for_resource::ListTagsForResourceError) -> Self {
match err {
crate::operation::list_tags_for_resource::ListTagsForResourceError::InternalServiceError(inner) => Error::InternalServiceError(inner),
crate::operation::list_tags_for_resource::ListTagsForResourceError::InvalidArgumentException(inner) => {
Error::InvalidArgumentException(inner)
}
crate::operation::list_tags_for_resource::ListTagsForResourceError::NotAuthorizedException(inner) => Error::NotAuthorizedException(inner),
crate::operation::list_tags_for_resource::ListTagsForResourceError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, 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::tag_resource::TagResourceError> for Error {
fn from(err: crate::operation::tag_resource::TagResourceError) -> Self {
match err {
crate::operation::tag_resource::TagResourceError::InternalServiceError(inner) => Error::InternalServiceError(inner),
crate::operation::tag_resource::TagResourceError::InvalidArgumentException(inner) => Error::InvalidArgumentException(inner),
crate::operation::tag_resource::TagResourceError::NotAuthorizedException(inner) => Error::NotAuthorizedException(inner),
crate::operation::tag_resource::TagResourceError::Unhandled(inner) => Error::Unhandled(inner),
}
}
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, 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::untag_resource::UntagResourceError> for Error {
fn from(err: crate::operation::untag_resource::UntagResourceError) -> Self {
match err {
crate::operation::untag_resource::UntagResourceError::InternalServiceError(inner) => Error::InternalServiceError(inner),
crate::operation::untag_resource::UntagResourceError::InvalidArgumentException(inner) => Error::InvalidArgumentException(inner),
crate::operation::untag_resource::UntagResourceError::NotAuthorizedException(inner) => Error::NotAuthorizedException(inner),
crate::operation::untag_resource::UntagResourceError::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::InternalServiceError(inner) => inner.source(),
Error::InvalidArgumentException(inner) => inner.source(),
Error::NotAuthorizedException(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::InternalServiceError(e) => e.request_id(),
Self::InvalidArgumentException(e) => e.request_id(),
Self::NotAuthorizedException(e) => e.request_id(),
Self::Unhandled(e) => e.meta.request_id(),
}
}
}