1use thiserror::Error;
4
5pub type SageResult<T> = Result<T, SageError>;
7
8#[derive(Debug, Error)]
10pub enum SageError {
11 #[error("LLM error: {0}")]
13 Llm(String),
14
15 #[error("Agent error: {0}")]
17 Agent(String),
18
19 #[error("Type error: expected {expected}, got {got}")]
21 Type { expected: String, got: String },
22
23 #[error("HTTP error: {0}")]
25 Http(#[from] reqwest::Error),
26
27 #[error("JSON error: {0}")]
29 Json(#[from] serde_json::Error),
30
31 #[error("Agent task failed: {0}")]
33 JoinError(String),
34}
35
36impl From<tokio::task::JoinError> for SageError {
37 fn from(e: tokio::task::JoinError) -> Self {
38 SageError::JoinError(e.to_string())
39 }
40}