use thiserror::Error;
#[derive(Debug, Error)]
pub enum MiniLLMError {
#[error("HTTP error: {0}")]
Http(#[from] reqwest::Error),
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
#[error("JSON repair error: {0}")]
JsonRepair(#[from] crate::json_repair::JsonRepairError),
#[error("API error ({status}): {message}")]
Api { status: u16, message: String },
#[error("Missing configuration: {0}")]
MissingConfig(String),
#[error("Invalid parameter: {0}")]
InvalidParameter(String),
#[error("Stream error: {0}")]
Stream(String),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Base64 error: {0}")]
Base64(#[from] base64::DecodeError),
#[error("URL error: {0}")]
Url(#[from] url::ParseError),
#[error("Request timed out")]
Timeout,
#[error("Node not found: {0}")]
NodeNotFound(String),
#[error("{0}")]
Other(String),
}
pub type Result<T> = std::result::Result<T, MiniLLMError>;