aws-sdk-lambdacore 1.0.0

AWS SDK for AWS Lambda Core
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// All possible error types for this service.
#[non_exhaustive]
#[derive(::std::fmt::Debug)]
pub enum Error {
    /// <p>One of the parameters in the request is not valid. Check the error message for details about which parameter failed validation.</p>
    InvalidParameterValueException(crate::types::error::InvalidParameterValueException),
    /// <p>The account has reached the maximum number of network connectors allowed. Delete unused connectors or request a limit increase through Service Quotas.</p>
    NetworkConnectorLimitExceededException(crate::types::error::NetworkConnectorLimitExceededException),
    /// <p>The request could not be completed due to a conflict with the current state of the resource. For example, attempting to update a connector that is not in <code>ACTIVE</code> state.</p>
    ResourceConflictException(crate::types::error::ResourceConflictException),
    /// <p>The specified network connector does not exist. Verify the identifier (ID, name, or ARN) and Region.</p>
    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
    /// <p>An internal service error occurred. Retry the request with exponential backoff.</p>
    ServiceException(crate::types::error::ServiceException),
    /// <p>The request was throttled due to exceeding the allowed request rate. Retry the request after a brief wait using exponential backoff.</p>
    TooManyRequestsException(crate::types::error::TooManyRequestsException),
    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
    variable wildcard pattern and check `.code()`:
     \
    &nbsp;&nbsp;&nbsp;`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::InvalidParameterValueException(inner) => inner.fmt(f),
            Error::NetworkConnectorLimitExceededException(inner) => inner.fmt(f),
            Error::ResourceConflictException(inner) => inner.fmt(f),
            Error::ResourceNotFoundException(inner) => inner.fmt(f),
            Error::ServiceException(inner) => inner.fmt(f),
            Error::TooManyRequestsException(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::InvalidParameterValueException(inner) => inner.meta(),
            Self::NetworkConnectorLimitExceededException(inner) => inner.meta(),
            Self::ResourceConflictException(inner) => inner.meta(),
            Self::ResourceNotFoundException(inner) => inner.meta(),
            Self::ServiceException(inner) => inner.meta(),
            Self::TooManyRequestsException(inner) => inner.meta(),
            Self::Unhandled(inner) => &inner.meta,
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_network_connector::CreateNetworkConnectorError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(
        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_network_connector::CreateNetworkConnectorError, 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_network_connector::CreateNetworkConnectorError> for Error {
    fn from(err: crate::operation::create_network_connector::CreateNetworkConnectorError) -> Self {
        match err {
            crate::operation::create_network_connector::CreateNetworkConnectorError::InvalidParameterValueException(inner) => {
                Error::InvalidParameterValueException(inner)
            }
            crate::operation::create_network_connector::CreateNetworkConnectorError::NetworkConnectorLimitExceededException(inner) => {
                Error::NetworkConnectorLimitExceededException(inner)
            }
            crate::operation::create_network_connector::CreateNetworkConnectorError::ResourceConflictException(inner) => {
                Error::ResourceConflictException(inner)
            }
            crate::operation::create_network_connector::CreateNetworkConnectorError::ServiceException(inner) => Error::ServiceException(inner),
            crate::operation::create_network_connector::CreateNetworkConnectorError::TooManyRequestsException(inner) => {
                Error::TooManyRequestsException(inner)
            }
            crate::operation::create_network_connector::CreateNetworkConnectorError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_network_connector::DeleteNetworkConnectorError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(
        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_network_connector::DeleteNetworkConnectorError, 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_network_connector::DeleteNetworkConnectorError> for Error {
    fn from(err: crate::operation::delete_network_connector::DeleteNetworkConnectorError) -> Self {
        match err {
            crate::operation::delete_network_connector::DeleteNetworkConnectorError::InvalidParameterValueException(inner) => {
                Error::InvalidParameterValueException(inner)
            }
            crate::operation::delete_network_connector::DeleteNetworkConnectorError::ResourceConflictException(inner) => {
                Error::ResourceConflictException(inner)
            }
            crate::operation::delete_network_connector::DeleteNetworkConnectorError::ResourceNotFoundException(inner) => {
                Error::ResourceNotFoundException(inner)
            }
            crate::operation::delete_network_connector::DeleteNetworkConnectorError::ServiceException(inner) => Error::ServiceException(inner),
            crate::operation::delete_network_connector::DeleteNetworkConnectorError::TooManyRequestsException(inner) => {
                Error::TooManyRequestsException(inner)
            }
            crate::operation::delete_network_connector::DeleteNetworkConnectorError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_network_connector::GetNetworkConnectorError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_network_connector::GetNetworkConnectorError, 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_network_connector::GetNetworkConnectorError> for Error {
    fn from(err: crate::operation::get_network_connector::GetNetworkConnectorError) -> Self {
        match err {
            crate::operation::get_network_connector::GetNetworkConnectorError::InvalidParameterValueException(inner) => {
                Error::InvalidParameterValueException(inner)
            }
            crate::operation::get_network_connector::GetNetworkConnectorError::ResourceNotFoundException(inner) => {
                Error::ResourceNotFoundException(inner)
            }
            crate::operation::get_network_connector::GetNetworkConnectorError::ServiceException(inner) => Error::ServiceException(inner),
            crate::operation::get_network_connector::GetNetworkConnectorError::TooManyRequestsException(inner) => {
                Error::TooManyRequestsException(inner)
            }
            crate::operation::get_network_connector::GetNetworkConnectorError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_network_connectors::ListNetworkConnectorsError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(
        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_network_connectors::ListNetworkConnectorsError, 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_network_connectors::ListNetworkConnectorsError> for Error {
    fn from(err: crate::operation::list_network_connectors::ListNetworkConnectorsError) -> Self {
        match err {
            crate::operation::list_network_connectors::ListNetworkConnectorsError::InvalidParameterValueException(inner) => {
                Error::InvalidParameterValueException(inner)
            }
            crate::operation::list_network_connectors::ListNetworkConnectorsError::ServiceException(inner) => Error::ServiceException(inner),
            crate::operation::list_network_connectors::ListNetworkConnectorsError::TooManyRequestsException(inner) => {
                Error::TooManyRequestsException(inner)
            }
            crate::operation::list_network_connectors::ListNetworkConnectorsError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_network_connector::UpdateNetworkConnectorError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(
        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_network_connector::UpdateNetworkConnectorError, 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_network_connector::UpdateNetworkConnectorError> for Error {
    fn from(err: crate::operation::update_network_connector::UpdateNetworkConnectorError) -> Self {
        match err {
            crate::operation::update_network_connector::UpdateNetworkConnectorError::InvalidParameterValueException(inner) => {
                Error::InvalidParameterValueException(inner)
            }
            crate::operation::update_network_connector::UpdateNetworkConnectorError::ResourceConflictException(inner) => {
                Error::ResourceConflictException(inner)
            }
            crate::operation::update_network_connector::UpdateNetworkConnectorError::ResourceNotFoundException(inner) => {
                Error::ResourceNotFoundException(inner)
            }
            crate::operation::update_network_connector::UpdateNetworkConnectorError::ServiceException(inner) => Error::ServiceException(inner),
            crate::operation::update_network_connector::UpdateNetworkConnectorError::TooManyRequestsException(inner) => {
                Error::TooManyRequestsException(inner)
            }
            crate::operation::update_network_connector::UpdateNetworkConnectorError::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::InvalidParameterValueException(inner) => inner.source(),
            Error::NetworkConnectorLimitExceededException(inner) => inner.source(),
            Error::ResourceConflictException(inner) => inner.source(),
            Error::ResourceNotFoundException(inner) => inner.source(),
            Error::ServiceException(inner) => inner.source(),
            Error::TooManyRequestsException(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::InvalidParameterValueException(e) => e.request_id(),
            Self::NetworkConnectorLimitExceededException(e) => e.request_id(),
            Self::ResourceConflictException(e) => e.request_id(),
            Self::ResourceNotFoundException(e) => e.request_id(),
            Self::ServiceException(e) => e.request_id(),
            Self::TooManyRequestsException(e) => e.request_id(),
            Self::Unhandled(e) => e.meta.request_id(),
        }
    }
}