summaryrefslogtreecommitdiff
path: root/src/error.rs
blob: 1e6eac10b5f127a96fe0248ff1faee91a414d6cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use std::{fmt::Debug, num::ParseIntError};

use reqwest::header::InvalidHeaderValue;

#[derive(Debug, thiserror::Error)]
pub enum Error {
    #[error("request: {source}")]
    Reqwest {
        #[from]
        source: reqwest::Error,
    },
    #[error("config: {source}")]
    Config {
        #[from]
        source: config::ConfigError,
    },
    #[error("serde: {source}")]
    Serde {
        #[from]
        source: serde_json::Error,
    },
    #[error("parse int: {source}")]
    Parse {
        #[from]
        source: ParseIntError,
    },
    #[error("parse header: {source}")]
    InvalidHeaderValue {
        #[from]
        source: InvalidHeaderValue,
    },
    #[error("tungstenite: {source}")]
    Tungstenite {
        #[from]
        source: tokio_tungstenite::tungstenite::Error,
    },
    #[error("faulty websocket response")]
    WsResponse,
    #[error("authorization failed")]
    Authorization,
    #[error("Http error status: {0}")]
    HttpStatus(u16),
}