use serde::Serialize;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum CoreError {
#[error("Backend error: {0}")]
Backend(String),
#[error("Context error: {0}")]
Context(String),
#[error("Tool error: {0}")]
Tool(String),
#[error("Agent error: {0}")]
Agent(String),
#[error("Aborted")]
Aborted,
}
impl Serialize for CoreError {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(&self.to_string())
}
}
pub type CoreResult<T> = Result<T, CoreError>;