capmonstercloud_client/
error.rs1use std::time::Duration;
4
5pub type Result<T> = std::result::Result<T, Error>;
7
8#[derive(Debug, thiserror::Error)]
10pub enum Error {
11 #[error("invalid request: {0}")]
14 Validation(String),
15
16 #[error("http error: {0}")]
18 Http(#[from] reqwest::Error),
19
20 #[error("unexpected HTTP status {status} from {method}")]
22 Status { method: &'static str, status: u16 },
23
24 #[error("cannot create task: [{code}] {description}")]
26 CreateTask { code: String, description: String },
27
28 #[error("cannot get task result: [{code}] {description}")]
30 GetResult { code: String, description: String },
31
32 #[error("cannot get balance: [{code}] {description}")]
34 GetBalance { code: String, description: String },
35
36 #[error("malformed API response: {0}")]
38 MalformedResponse(String),
39
40 #[error("failed to get a solution within {0:?}")]
42 Timeout(Duration),
43
44 #[error("unsupported client proxy type: {0}")]
46 UnsupportedProxyType(String),
47
48 #[error("json error: {0}")]
50 Json(#[from] serde_json::Error),
51}