summaryrefslogblamecommitdiff
path: root/src/error.rs
blob: 1e6eac10b5f127a96fe0248ff1faee91a414d6cb (plain) (tree)
1
2
3
4
                                          
 
                                        
 
























                                      
                                   
      





                                                      
               



                                      
 
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),
}