use std::path::PathBuf;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("plugin not found: {0}")]
PluginNotFound(String),
#[error("failed to load plugin at {path}: {reason}")]
LoadFailed {
path: PathBuf,
reason: String,
},
#[error("[{format}] {message} (code {code})")]
Format {
format: &'static str,
code: i64,
message: String,
},
#[error("parameter index {0} out of range")]
InvalidParameter(usize),
#[error("plugin not activated")]
NotActivated,
#[error("state load failed: {0}")]
StateLoad(#[from] crate::state::StateLoadError),
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("plugin {action} panicked: {message}")]
Panic {
action: &'static str,
message: String,
},
#[error("{0}")]
Other(String),
}