tauri_plugin_frame/
error.rs

1use serde::{Serialize, Serializer};
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Debug)]
6pub struct Error(pub eyre::Report);
7
8impl std::fmt::Display for Error {
9    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10        write!(f, "{}", self.0)
11    }
12}
13
14impl std::error::Error for Error {}
15
16impl Serialize for Error {
17    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18    where
19        S: Serializer,
20    {
21        serializer.serialize_str(&self.0.to_string())
22    }
23}
24
25impl From<eyre::Report> for Error {
26    fn from(error: eyre::Report) -> Self {
27        Self(error)
28    }
29}
30
31impl From<tauri::Error> for Error {
32    fn from(error: tauri::Error) -> Self {
33        Self(eyre::eyre!(error))
34    }
35}