Skip to main content

tauri_plugin_vicons/
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("IO error: {0}")]
8    Io(#[from] std::io::Error),
9    #[error("Icon not found: {0}")]
10    IconNotFound(String),
11    #[error("Theme monitor initialization failed")]
12    ThemeMonitorError,
13}
14
15impl Serialize for Error {
16    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17    where
18        S: Serializer,
19    {
20        serializer.serialize_str(self.to_string().as_ref())
21    }
22}