Skip to main content

hibp_sync_client/
error.rs

1#[derive(Debug, thiserror::Error)]
2pub enum Error {
3    #[error("invalid server URL: {0}")]
4    InvalidServerUrl(&'static str),
5
6    #[error("HTTP request build error: {0}")]
7    RequestBuild(#[from] http::Error),
8
9    #[error("HTTP request error: {0}")]
10    Request(#[from] hyper_util::client::legacy::Error),
11
12    #[error("HTTP response read error: {0}")]
13    ResponseRead(#[from] hyper::Error),
14
15    #[error("HTTP error status: {0}")]
16    HttpStatus(http::StatusCode),
17
18    #[error("I/O error: {0}")]
19    Io(#[from] std::io::Error),
20
21    #[error("JSON error: {0}")]
22    Json(#[from] serde_json::Error),
23
24    #[error("segment decode error: {0}")]
25    Decode(String),
26
27    #[error("invalid configuration: {0}")]
28    InvalidConfig(&'static str),
29
30    #[error("timed out: {0}")]
31    Timeout(&'static str),
32
33    #[error("server busy: retry later")]
34    ServerBusy,
35}