use const_hex::FromHexError;
use crate::config::technology::openpgp::TRUST_AMOUNT_MAX;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Invalid OpenPGP fingerprint {fingerprint} while {context}: {source}")]
InvalidOpenpgpFingerprint {
fingerprint: String,
context: String,
source: FromHexError,
},
#[error("Invalid OpenPGP fingerprint length {fingerprint} ({}). Need 40 for OpenPGP v4 or 64 for OpenPGP v6", fingerprint.len())]
InvalidOpenpgpFingerprintLength {
fingerprint: String,
},
#[error("The domain name {domain_name} is invalid:\n{message}")]
InvalidDomainName {
domain_name: String,
message: String,
},
#[error(
"The provided trust amount {amount} is outside the allowed range of 1 - {TRUST_AMOUNT_MAX}"
)]
InvalidTrustAmount {
amount: usize,
},
#[error("Integer parsing error while parsing value {value} for {context}: {source}")]
ParseInt {
value: String,
context: String,
source: std::num::ParseIntError,
},
}