tauri_plugin_machine_uid/
error.rs1use serde::Serialize;
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Debug, thiserror::Error, specta::Type, Serialize)]
6#[serde(rename_all = "camelCase", tag = "type", content = "content")]
7pub enum Error {
8 #[error("IO error: {0}")]
9 Io(String),
10 #[error("Mobile error: {0}")]
11 PluginInvoke(String),
12}
13
14impl From<std::io::Error> for Error {
15 fn from(e: std::io::Error) -> Self {
16 Error::Io(e.to_string())
17 }
18}
19
20#[cfg(mobile)]
21impl From<tauri::plugin::mobile::PluginInvokeError> for Error {
22 #[cfg(mobile)]
23 fn from(e: tauri::plugin::mobile::PluginInvokeError) -> Self {
24 Error::PluginInvoke(e.to_string())
25 }
26}