atomr_agents_deep_research_shell/
error.rs1use atomr_agents_core::AgentError;
4use thiserror::Error;
5
6#[derive(Debug, Error)]
8pub enum ShellError {
9 #[error("configuration error: {0}")]
11 Config(String),
12
13 #[error("classifier error: {0}")]
15 Classifier(String),
16
17 #[error("shallow path error: {0}")]
19 Shallow(String),
20
21 #[error("deep harness error: {0}")]
23 Deep(String),
24
25 #[error("web search error: {0}")]
27 WebSearch(#[from] atomr_agents_web_search_core::WebSearchError),
28
29 #[error("serialization error: {0}")]
31 Serde(#[from] serde_json::Error),
32
33 #[error("internal error: {0}")]
35 Internal(String),
36}
37
38impl ShellError {
39 pub fn config(msg: impl Into<String>) -> Self {
40 Self::Config(msg.into())
41 }
42 pub fn classifier(msg: impl Into<String>) -> Self {
43 Self::Classifier(msg.into())
44 }
45 pub fn shallow(msg: impl Into<String>) -> Self {
46 Self::Shallow(msg.into())
47 }
48 pub fn deep(msg: impl Into<String>) -> Self {
49 Self::Deep(msg.into())
50 }
51 pub fn internal(msg: impl Into<String>) -> Self {
52 Self::Internal(msg.into())
53 }
54}
55
56impl From<ShellError> for AgentError {
57 fn from(e: ShellError) -> Self {
58 AgentError::Harness(e.to_string())
59 }
60}
61
62pub type Result<T, E = ShellError> = std::result::Result<T, E>;