1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
use snafu::Snafu;

#[derive(Debug, Snafu)]
#[snafu(visibility(pub(crate)))]
pub enum Error {
    #[snafu(display("Network: {}", "source"))]
    Network { source: reqwest::Error },

    #[snafu(display("JSON: {}", "source"))]
    Json {
        reason: String,
        source: serde_json::Error,
    },

    #[snafu(display("General: [{}] {}", "code", "message"))]
    General { code: u16, message: String },
}

pub type Result<T> = std::result::Result<T, Error>;