1#[derive(Debug, thiserror::Error)]
5pub enum OllamaError {
6 #[error("HTTP request failed: {0}")]
7 Http(#[from] reqwest::Error),
8
9 #[error("JSON error: {0}")]
10 Json(#[from] serde_json::Error),
11
12 #[error("Ollama API error ({status}): {message}")]
13 Api { status: u16, message: String },
14
15 #[error("stream ended unexpectedly")]
16 UnexpectedEndOfStream,
17
18 #[error("NDJSON line exceeds maximum size of {max_bytes} bytes")]
19 LineTooLarge { max_bytes: usize },
20
21 #[error("invalid base URL: {0}")]
22 InvalidBaseUrl(String),
23
24 #[error("invalid blob digest: {0}")]
25 InvalidDigest(String),
26
27 #[error("I/O error: {0}")]
28 Io(#[from] std::io::Error),
29}
30
31pub type Result<T> = std::result::Result<T, OllamaError>;