Skip to main content

tauri_plugin_modular_agent/
error.rs

1use serde::{ser::Serializer, Serialize};
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Debug, thiserror::Error)]
6pub enum Error {
7  #[error(transparent)]
8  Io(#[from] std::io::Error),
9
10  #[error(transparent)]
11  ModularAgent(#[from] modular_agent_core::AgentError),
12
13  #[error(transparent)]
14  SerdeJson(#[from] serde_json::error::Error),
15}
16
17impl Serialize for Error {
18  fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19  where
20    S: Serializer,
21  {
22    serializer.serialize_str(self.to_string().as_ref())
23  }
24}