#[non_exhaustive]
#[derive(std::fmt::Debug)]
pub enum Error {
DocktorError(crate::error::DocktorError),
HealtcheckError(crate::error::HealtcheckError),
PrometheusError(crate::error::PrometheusError),
SystemdError(crate::error::SystemdError),
Unhandled(Box<dyn std::error::Error + Send + Sync + 'static>),
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Error::DocktorError(inner) => inner.fmt(f),
Error::HealtcheckError(inner) => inner.fmt(f),
Error::PrometheusError(inner) => inner.fmt(f),
Error::SystemdError(inner) => inner.fmt(f),
Error::Unhandled(inner) => inner.fmt(f),
}
}
}
impl<R> From<aws_smithy_http::result::SdkError<crate::error::HealthcheckOperationError, R>>
for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: aws_smithy_http::result::SdkError<crate::error::HealthcheckOperationError, R>,
) -> Self {
match err {
aws_smithy_http::result::SdkError::ServiceError { err, .. } => match err.kind {
crate::error::HealthcheckOperationErrorKind::HealtcheckError(inner) => {
Error::HealtcheckError(inner)
}
crate::error::HealthcheckOperationErrorKind::Unhandled(inner) => {
Error::Unhandled(inner)
}
},
_ => Error::Unhandled(err.into()),
}
}
}
impl<R> From<aws_smithy_http::result::SdkError<crate::error::ListOperationError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: aws_smithy_http::result::SdkError<crate::error::ListOperationError, R>) -> Self {
match err {
aws_smithy_http::result::SdkError::ServiceError { err, .. } => match err.kind {
crate::error::ListOperationErrorKind::Unhandled(inner) => Error::Unhandled(inner),
},
_ => Error::Unhandled(err.into()),
}
}
}
impl<R> From<aws_smithy_http::result::SdkError<crate::error::PrometheusTargetOperationError, R>>
for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: aws_smithy_http::result::SdkError<crate::error::PrometheusTargetOperationError, R>,
) -> Self {
match err {
aws_smithy_http::result::SdkError::ServiceError { err, .. } => match err.kind {
crate::error::PrometheusTargetOperationErrorKind::DocktorError(inner) => {
Error::DocktorError(inner)
}
crate::error::PrometheusTargetOperationErrorKind::PrometheusError(inner) => {
Error::PrometheusError(inner)
}
crate::error::PrometheusTargetOperationErrorKind::Unhandled(inner) => {
Error::Unhandled(inner)
}
},
_ => Error::Unhandled(err.into()),
}
}
}
impl<R> From<aws_smithy_http::result::SdkError<crate::error::RestartOperationError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: aws_smithy_http::result::SdkError<crate::error::RestartOperationError, R>,
) -> Self {
match err {
aws_smithy_http::result::SdkError::ServiceError { err, .. } => match err.kind {
crate::error::RestartOperationErrorKind::DocktorError(inner) => {
Error::DocktorError(inner)
}
crate::error::RestartOperationErrorKind::SystemdError(inner) => {
Error::SystemdError(inner)
}
crate::error::RestartOperationErrorKind::Unhandled(inner) => {
Error::Unhandled(inner)
}
},
_ => Error::Unhandled(err.into()),
}
}
}
impl<R> From<aws_smithy_http::result::SdkError<crate::error::StartOperationError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: aws_smithy_http::result::SdkError<crate::error::StartOperationError, R>) -> Self {
match err {
aws_smithy_http::result::SdkError::ServiceError { err, .. } => match err.kind {
crate::error::StartOperationErrorKind::DocktorError(inner) => {
Error::DocktorError(inner)
}
crate::error::StartOperationErrorKind::SystemdError(inner) => {
Error::SystemdError(inner)
}
crate::error::StartOperationErrorKind::Unhandled(inner) => Error::Unhandled(inner),
},
_ => Error::Unhandled(err.into()),
}
}
}
impl<R> From<aws_smithy_http::result::SdkError<crate::error::StopOperationError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: aws_smithy_http::result::SdkError<crate::error::StopOperationError, R>) -> Self {
match err {
aws_smithy_http::result::SdkError::ServiceError { err, .. } => match err.kind {
crate::error::StopOperationErrorKind::DocktorError(inner) => {
Error::DocktorError(inner)
}
crate::error::StopOperationErrorKind::SystemdError(inner) => {
Error::SystemdError(inner)
}
crate::error::StopOperationErrorKind::Unhandled(inner) => Error::Unhandled(inner),
},
_ => Error::Unhandled(err.into()),
}
}
}
impl std::error::Error for Error {}