Skip to main content

merlion_core/
error.rs

1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Debug, Error)]
6pub enum Error {
7    #[error("llm error: {0}")]
8    Llm(String),
9
10    #[error("tool `{name}` not found")]
11    ToolNotFound { name: String },
12
13    #[error("tool `{name}` failed: {message}")]
14    ToolFailed { name: String, message: String },
15
16    #[error("invalid tool arguments for `{name}`: {message}")]
17    InvalidToolArgs { name: String, message: String },
18
19    #[error("conversation interrupted")]
20    Interrupted,
21
22    #[error("iteration budget exhausted")]
23    BudgetExhausted,
24
25    #[error(transparent)]
26    Json(#[from] serde_json::Error),
27
28    #[error(transparent)]
29    Io(#[from] std::io::Error),
30
31    #[error("{0}")]
32    Other(#[from] anyhow::Error),
33}