1use thiserror::Error;
2
3#[derive(Debug, Error)]
5pub enum VeilError {
6 #[error("HTTP error: {0}")]
8 Http(#[from] reqwest::Error),
9
10 #[error("gateway error {status}: {message}")]
12 Api { status: u16, message: String },
13
14 #[error("job {job_id} timed out after {elapsed_ms}ms (last status: {last_status})")]
16 Timeout {
17 job_id: String,
18 elapsed_ms: u64,
19 last_status: String,
20 },
21
22 #[error("job {job_id} failed: {}", reason.as_deref().unwrap_or("no reason given"))]
24 JobFailed {
25 job_id: String,
26 reason: Option<String>,
27 },
28
29 #[error("invalid base URL: {0}")]
31 InvalidUrl(String),
32
33 #[error("failed to deserialise response: {0}")]
35 Deserialize(#[from] serde_json::Error),
36}
37
38pub type Result<T> = std::result::Result<T, VeilError>;