summaryrefslogtreecommitdiff
path: root/src/error.rs
blob: 531528fc3f42da9758f06ca134a066c911ca12e0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use std::{fmt::Debug, num::ParseIntError};

pub enum CliError {
    Reqwest(reqwest::Error),
    Config(config::ConfigError),
    Serde(serde_json::Error),
    Parse(ParseIntError),
    WsResponse,
}

impl Debug for CliError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::Reqwest(err) => err.fmt(f),
            Self::Config(err) => err.fmt(f),
            Self::Serde(err) => err.fmt(f),
            Self::Parse(err) => err.fmt(f),
            Self::WsResponse => f.write_str("Error in Response"),
        }
    }
}