Skip to main content

haloforge_plugin_api/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error, serde::Serialize, serde::Deserialize)]
4pub enum PluginError {
5    #[error("Permission denied: {0}")]
6    PermissionDenied(String),
7
8    #[error("Database error: {0}")]
9    Database(String),
10
11    #[error("IO error: {0}")]
12    Io(String),
13
14    #[error("Network error: {0}")]
15    Network(String),
16
17    #[error("Serialization error: {0}")]
18    Serialization(String),
19
20    #[error("Plugin initialization failed: {0}")]
21    InitFailed(String),
22
23    #[error("Unsupported operation: {0}")]
24    Unsupported(String),
25
26    #[error("Process error: {0}")]
27    Process(String),
28
29    #[error("Not found: {0}")]
30    NotFound(String),
31
32    #[error("{0}")]
33    Custom(String),
34}
35
36impl From<std::io::Error> for PluginError {
37    fn from(e: std::io::Error) -> Self {
38        Self::Io(e.to_string())
39    }
40}