Skip to main content

peasy_css/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum PeasyError {
5    #[error("HTTP request failed: {0}")]
6    Http(#[from] reqwest::Error),
7
8    #[error("Not found: {resource} '{identifier}'")]
9    NotFound { resource: String, identifier: String },
10
11    #[error("API error (HTTP {status}): {body}")]
12    Api { status: u16, body: String },
13
14    #[error("JSON decode error: {0}")]
15    Decode(#[from] serde_json::Error),
16}
17
18pub type Result<T> = std::result::Result<T, PeasyError>;