lib_client_ollama/
error.rs1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum OllamaError {
8 #[error("Request failed: {0}")]
10 Request(#[from] reqwest::Error),
11
12 #[error("API error ({status}): {message}")]
14 Api { status: u16, message: String },
15
16 #[error("Model not found: {0}")]
18 ModelNotFound(String),
19
20 #[error("Connection refused: is Ollama running?")]
22 ConnectionRefused,
23
24 #[error("JSON error: {0}")]
26 Json(#[from] serde_json::Error),
27
28 #[error("Invalid request: {0}")]
30 InvalidRequest(String),
31}
32
33pub type Result<T> = std::result::Result<T, OllamaError>;