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
44
use isahc::http;

#[derive(thiserror::Error, Debug)]
pub enum Error {
    #[error("IsahcError {0:?}")]
    IsahcError(#[from] isahc::Error),
    #[error("HttpInvalidUri {0:?}")]
    HttpInvalidUri(#[from] http::uri::InvalidUri),
    #[error("UrlParseError {0:?}")]
    UrlParseError(#[from] url::ParseError),
    #[error("IoError {0:?}")]
    IoError(#[from] std::io::Error),
    //
    #[error("ClientExecuteError {0:?}")]
    ClientExecuteError(#[from] ClientExecuteError),
    #[error("ClientInsertWithFormatError {0:?}")]
    ClientInsertWithFormatError(#[from] ClientInsertWithFormatError),
    #[error("ClientSelectWithFormatError {0:?}")]
    ClientSelectWithFormatError(#[from] ClientSelectWithFormatError),
}

#[derive(thiserror::Error, Debug)]
pub enum ClientExecuteError {
    #[error("StatusCodeMismatch {0:?}")]
    StatusCodeMismatch(http::StatusCode),
}

#[derive(thiserror::Error, Debug)]
pub enum ClientInsertWithFormatError {
    #[error("FormatSerError {0:?}")]
    FormatSerError(String),
    #[error("StatusCodeMismatch {0:?}")]
    StatusCodeMismatch(http::StatusCode),
}

#[derive(thiserror::Error, Debug)]
pub enum ClientSelectWithFormatError {
    #[error("StatusCodeMismatch {0:?}")]
    StatusCodeMismatch(http::StatusCode),
    #[error("FormatMismatch {0:?}")]
    FormatMismatch(String),
    #[error("FormatDeError {0:?}")]
    FormatDeError(String),
}