1use std::path::PathBuf;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
8pub enum PluginError {
9 #[error("Plugin directory is not a directory: {0}")]
11 NotADirectory(PathBuf),
12
13 #[error("Failed to load plugin from {path}: {message}")]
15 LoadFailed { path: PathBuf, message: String },
16
17 #[error("Plugin API version mismatch: expected {expected}, found {found} in {path}")]
19 VersionMismatch {
20 expected: u32,
21 found: u32,
22 path: PathBuf,
23 },
24
25 #[error("Duplicate plugin name: {0}")]
27 DuplicatePlugin(String),
28
29 #[error("Duplicate tool name '{tool}' from plugin '{plugin}'")]
31 DuplicateTool { tool: String, plugin: String },
32
33 #[error("Invalid tool info from plugin: {0}")]
35 InvalidToolInfo(String),
36
37 #[error("Plugin execution failed: {0}")]
39 ExecutionFailed(String),
40}