1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
pub type Result<T> = std::result::Result<T, CliError>;

#[derive(Debug, thiserror::Error)]
pub enum CliError {
    #[error(transparent)]
    Api(#[from] busylib::Error),

    #[error("could not render the result as JSON")]
    Json(#[from] serde_json::Error),
}

impl From<busylib::InvalidValue> for CliError {
    fn from(error: busylib::InvalidValue) -> Self {
        Self::Api(busylib::Error::Value(error))
    }
}