Skip to main content

tauri_agent_plugin/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum Error {
5    #[error("stale ref {0}; run tree again")]
6    StaleRef(String),
7    #[error("live bridge unavailable: {0}")]
8    BridgeUnavailable(String),
9    #[error("window not found: {0}")]
10    WindowNotFound(String),
11    #[error("invalid params: {0}")]
12    InvalidParams(String),
13    #[error("timed out: {0}")]
14    Timeout(String),
15    #[error("io error: {0}")]
16    Io(String),
17    #[error("unsupported on this platform: {0}")]
18    UnsupportedPlatform(String),
19    #[error("{0}")]
20    Tauri(#[from] tauri::Error),
21}
22
23impl serde::Serialize for Error {
24    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
25    where
26        S: serde::ser::Serializer,
27    {
28        serializer.serialize_str(&self.to_string())
29    }
30}