pipedash_plugin_api/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum PluginError {
5    #[error("Authentication failed: {0}")]
6    AuthenticationFailed(String),
7
8    #[error("API error: {0}")]
9    ApiError(String),
10
11    #[error("Invalid configuration: {0}")]
12    InvalidConfig(String),
13
14    #[error("Pipeline not found: {0}")]
15    PipelineNotFound(String),
16
17    #[error("Provider not supported: {0}")]
18    ProviderNotSupported(String),
19
20    #[error("Network error: {0}")]
21    NetworkError(String),
22
23    #[error("Serialization error: {0}")]
24    SerializationError(String),
25
26    #[error("Database error: {0}")]
27    DatabaseError(String),
28
29    #[error("Operation not supported: {0}")]
30    NotSupported(String),
31
32    #[error("Internal error: {0}")]
33    Internal(String),
34}
35
36pub type PluginResult<T> = Result<T, PluginError>;
37
38impl From<serde_json::Error> for PluginError {
39    fn from(err: serde_json::Error) -> Self {
40        PluginError::SerializationError(err.to_string())
41    }
42}