Skip to main content

deepseek/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum DeepSeekError {
5    #[error("API error ({status}): {body}")]
6    Api { status: u16, body: String },
7
8    #[error("no choices in response")]
9    EmptyResponse,
10
11    #[error("serialization error: {0}")]
12    Serialization(#[from] serde_json::Error),
13
14    #[error("{0}")]
15    Other(String),
16
17    #[cfg(feature = "reqwest-client")]
18    #[error("HTTP error: {0}")]
19    Reqwest(#[from] reqwest::Error),
20}
21
22pub type Result<T> = std::result::Result<T, DeepSeekError>;