use std::path::PathBuf;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum PluginError {
#[error("plugin io {path}: {source}")]
Io {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("plugin parse {path}: {source}")]
Parse {
path: PathBuf,
#[source]
source: serde_json::Error,
},
#[error("plugin invalid {path}: {message}")]
Invalid {
path: PathBuf,
message: String,
},
#[error(
"plugin name '{manifest_name}' does not match parent directory '{dir_name}' (at {path})"
)]
NameMismatch {
manifest_name: String,
dir_name: String,
path: PathBuf,
},
#[error("marketplace '{url}' is not in plugins.marketplaces.strict_known")]
UnknownMarketplace {
url: String,
},
#[error("marketplace '{url}' is in plugins.marketplaces.blocked")]
BlockedMarketplace {
url: String,
},
#[error("plugin '{name}' not found in marketplace '{url}'")]
PluginNotFound {
name: String,
url: String,
},
#[error("sha256 mismatch for '{name}' (expected {expected}, got {actual})")]
Sha256Mismatch {
name: String,
expected: String,
actual: String,
},
#[error(
"plugin '{name}' is not managed-scope; strict-plugin-only-customization mode rejects it"
)]
StrictPluginOnly {
name: String,
},
#[error("http transport error: {0}")]
Http(#[from] reqwest::Error),
#[error("invalid url: {0}")]
Url(#[from] url::ParseError),
#[error("extract: {0}")]
Extract(String),
}