1use std::fmt;
4
5#[derive(Debug)]
7pub enum PluginError {
8 InitializationFailed(String),
10 ProcessingError(String),
12 StateError(String),
14 EditorError(String),
16 PlatformError(String),
18 WebViewError(String),
20}
21
22impl fmt::Display for PluginError {
23 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24 match self {
25 Self::InitializationFailed(msg) => write!(f, "Initialization failed: {}", msg),
26 Self::ProcessingError(msg) => write!(f, "Processing error: {}", msg),
27 Self::StateError(msg) => write!(f, "State error: {}", msg),
28 Self::EditorError(msg) => write!(f, "Editor error: {}", msg),
29 Self::PlatformError(msg) => write!(f, "Platform error: {}", msg),
30 Self::WebViewError(msg) => write!(f, "WebView error: {}", msg),
31 }
32 }
33}
34
35impl std::error::Error for PluginError {}
36
37pub type PluginResult<T> = Result<T, PluginError>;