Skip to main content

vs_plugin_api/
error.rs

1use std::path::PathBuf;
2
3use thiserror::Error;
4
5/// Errors shared by plugin backends.
6#[derive(Debug, Error)]
7pub enum PluginError {
8    /// The plugin source could not be parsed.
9    #[error("failed to parse plugin source at {path}: {message}")]
10    InvalidSource { path: PathBuf, message: String },
11    /// The requested plugin version is not exposed by the plugin.
12    #[error("plugin {plugin} does not expose version {version}")]
13    VersionNotFound { plugin: String, version: String },
14    /// The plugin did not provide a result for the requested hook.
15    #[error("plugin did not provide a result")]
16    NoResultProvided,
17    /// The backend hit an execution error.
18    #[error("plugin backend error: {0}")]
19    Backend(String),
20}
21
22/// Shared result type for plugin operations.
23pub type PluginResult<T> = Result<T, PluginError>;