ag_ui_core/
error.rs

1use thiserror::Error;
2
3impl AguiError {
4    pub fn new(message: impl Into<String>) -> Self {
5        Self {
6            message: message.into(),
7        }
8    }
9}
10
11impl From<serde_json::Error> for AguiError {
12    fn from(err: serde_json::Error) -> Self {
13        let msg = format!("Failed to parse JSON: {err}");
14        Self::new(msg)
15    }
16}
17
18#[derive(Error, Debug)]
19#[error("AG-UI Error: {message}")]
20pub struct AguiError {
21    pub message: String,
22}
23
24pub type Result<T> = std::result::Result<T, AguiError>;