use std::path::PathBuf;
use voa_core::identifiers::{Purpose, Technology};
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("I/O error at path {path} while {context}:\n{source}")]
IoPath {
path: PathBuf,
context: &'static str,
source: std::io::Error,
},
#[error("The path {path:?} is not a regular file")]
PathIsNotAFile {
path: PathBuf,
},
#[error("The path {path:?} is not a directory or a regular file")]
PathIsNotDirOrFile {
path: PathBuf,
},
#[error("There is no default VOA load path for this user")]
NoLoadPath,
#[error("The {technology} technology is not (yet) supported")]
UnsupportedTechnology {
technology: Technology,
},
#[error("VOA core error:\n{0}")]
VoaCore(#[from] voa_core::Error),
#[error("VOA OpenPGP error:\n{0}")]
VoaOpenPgp(#[from] voa_openpgp::Error),
#[error("JSON serialization error while {context}: {source}")]
#[cfg(feature = "cli")]
JsonSerialization {
context: &'static str,
source: serde_json::Error,
},
#[error("The verification of the following signatures failed: {}", signatures.join(", "))]
SignatureVerificationFailed {
signatures: Vec<String>,
},
#[error(
"The purpose {purpose} represents the trust anchor mode, but should represent the artifact verifier mode"
)]
PurposeIsATrustAnchor {
purpose: Purpose,
},
}