tauri_plugin_mpv/
error.rs1use 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 #[cfg(mobile)]
10 #[error(transparent)]
11 PluginInvoke(#[from] tauri::plugin::mobile::PluginInvokeError),
12 #[error("Not found window with label: '{0}'")]
13 WindowNotFound(String),
14 #[error("Unsupported platform {0}")]
15 UnsupportedPlatform(String),
16 #[error("Failed to get window handle: {0}")]
17 WindowHandle(#[from] raw_window_handle::HandleError),
18 #[error("mpv process failed: {0}")]
19 MpvProcessError(String),
20 #[error("IPC communication error: {0}")]
21 IpcError(String),
22}
23
24impl Serialize for Error {
25 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26 where
27 S: Serializer,
28 {
29 serializer.serialize_str(self.to_string().as_ref())
30 }
31}