use crate::error::{BoxError, Context};
use thiserror::Error;
pub type Error = crate::Error<ErrorKind>;
#[derive(Copy, Clone, Debug, Eq, Error, PartialEq)]
pub enum ErrorKind {
#[error("invalid label")]
LabelInvalid,
#[error("report failed")]
ReportFailed,
#[error("setup failed")]
SetupFailed,
}
impl ErrorKind {
pub fn context(self, source: impl Into<BoxError>) -> Context<ErrorKind> {
Context::new(self, Some(source.into()))
}
}
impl From<crate::client::Error> for Error {
fn from(client_error: crate::client::Error) -> Error {
ErrorKind::SetupFailed.context(client_error).into()
}
}