#[non_exhaustive]
#[derive(::std::fmt::Debug)]
pub enum Error {
InvalidParameterValueException(crate::types::error::InvalidParameterValueException),
NetworkConnectorLimitExceededException(crate::types::error::NetworkConnectorLimitExceededException),
ResourceConflictException(crate::types::error::ResourceConflictException),
ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
ServiceException(crate::types::error::ServiceException),
TooManyRequestsException(crate::types::error::TooManyRequestsException),
#[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::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(),
}
}
}