use atomr_agents_core::AgentError;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum ShellError {
#[error("configuration error: {0}")]
Config(String),
#[error("classifier error: {0}")]
Classifier(String),
#[error("shallow path error: {0}")]
Shallow(String),
#[error("deep harness error: {0}")]
Deep(String),
#[error("web search error: {0}")]
WebSearch(#[from] atomr_agents_web_search_core::WebSearchError),
#[error("serialization error: {0}")]
Serde(#[from] serde_json::Error),
#[error("internal error: {0}")]
Internal(String),
}
impl ShellError {
pub fn config(msg: impl Into<String>) -> Self {
Self::Config(msg.into())
}
pub fn classifier(msg: impl Into<String>) -> Self {
Self::Classifier(msg.into())
}
pub fn shallow(msg: impl Into<String>) -> Self {
Self::Shallow(msg.into())
}
pub fn deep(msg: impl Into<String>) -> Self {
Self::Deep(msg.into())
}
pub fn internal(msg: impl Into<String>) -> Self {
Self::Internal(msg.into())
}
}
impl From<ShellError> for AgentError {
fn from(e: ShellError) -> Self {
AgentError::Harness(e.to_string())
}
}
pub type Result<T, E = ShellError> = std::result::Result<T, E>;