Skip to main content

seher/claude/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum ClaudeApiError {
5    #[error("HTTP request error: {0}")]
6    RequestError(#[from] reqwest::Error),
7
8    #[error("JSON parse error: {0}")]
9    ParseError(#[from] serde_json::Error),
10
11    #[cfg(feature = "browser")]
12    #[error("Cookie not found: {0}")]
13    CookieNotFound(String),
14
15    #[error("API error (status {status}): {body}")]
16    ApiError { status: u16, body: String },
17}
18
19pub type Result<T> = std::result::Result<T, ClaudeApiError>;