use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("Configuration error: {0}")]
Config(String),
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("Serialization error: {0}")]
Serialization(String),
#[error("Session error: {0}")]
Session(String),
#[error("Channel error: {0}")]
Channel(String),
#[error("Provider error: {0}")]
Provider(String),
#[error("Tool error: {0}")]
Tool(String),
#[error("Validation error: {0}")]
Validation(String),
#[error("Not found: {0}")]
NotFound(String),
#[error("Unauthorized: {0}")]
Unauthorized(String),
#[error("Internal error: {0}")]
Internal(String),
}
pub type Result<T> = std::result::Result<T, Error>;
impl From<serde_json::Error> for Error {
fn from(e: serde_json::Error) -> Self {
Error::Serialization(e.to_string())
}
}
impl From<config::ConfigError> for Error {
fn from(e: config::ConfigError) -> Self {
Error::Config(e.to_string())
}
}