use thiserror::Error;
#[derive(Debug, Error)]
pub enum VeilError {
#[error("HTTP error: {0}")]
Http(#[from] reqwest::Error),
#[error("gateway error {status}: {message}")]
Api { status: u16, message: String },
#[error("job {job_id} timed out after {elapsed_ms}ms (last status: {last_status})")]
Timeout {
job_id: String,
elapsed_ms: u64,
last_status: String,
},
#[error("job {job_id} failed: {}", reason.as_deref().unwrap_or("no reason given"))]
JobFailed {
job_id: String,
reason: Option<String>,
},
#[error("invalid base URL: {0}")]
InvalidUrl(String),
#[error("failed to deserialise response: {0}")]
Deserialize(#[from] serde_json::Error),
}
pub type Result<T> = std::result::Result<T, VeilError>;