1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use thiserror::Error;

pub const SETTINGS_ERROR: &str = "Uh Oh, looks like a settings issue! By default I look for a settings.toml file and override with env variables.";

/// A generic “error” type
#[derive(Error, Debug)]
pub enum ToolError {
    /// A general error used as a catch all for other errors via anyhow
    #[error(transparent)]
    General(#[from] anyhow::Error),
    /// URL parsing related errors
    #[error(transparent)]
    Url(#[from] url::ParseError),
    /// JSON Serialization\Deserialization related errors
    #[error(transparent)]
    Json(#[from] serde_json::Error),
    /// Integer parsing related errors
    #[error(transparent)]
    Int(#[from] std::num::ParseIntError),
    /// std IO related errors
    #[error(transparent)]
    Io(#[from] std::io::Error),
}