Skip to main content

tauri_plugin_wdio/
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    #[cfg(mobile)]
10    #[error(transparent)]
11    PluginInvoke(#[from] tauri::plugin::mobile::PluginInvokeError),
12
13    #[error("Execute error: {0}")]
14    ExecuteError(String),
15
16    #[error("Mock error: {0}")]
17    MockError(String),
18
19    #[error("Serialization error: {0}")]
20    SerializationError(String),
21
22    #[error("Window error: {0}")]
23    WindowError(String),
24}
25
26impl Serialize for Error {
27    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28    where
29        S: Serializer,
30    {
31        serializer.serialize_str(self.to_string().as_ref())
32    }
33}