pub enum Error {
Generation(GenerationError),
Validation(ValidationError),
}Expand description
The main error type for the age-setup crate.
All fallible operations in the library return a Result<T> where the error
is of this type. It is deliberately kept small and covers only the failure
modes that can occur:
- Generation failures – when the underlying
agelibrary fails to create a new identity. - Validation failures – when a public or secret key does not meet the expected format.
§Example
use age_setup::Error;
fn handle_error(e: Error) {
match e {
Error::Generation(err) => eprintln!("Generation error: {}", err),
Error::Validation(err) => eprintln!("Validation error: {}", err),
}
}Variants§
Generation(GenerationError)
An error that occurred during key generation.
This variant wraps GenerationError and is produced by
build_keypair if the internal identity generation
fails.
Validation(ValidationError)
An error that occurred while validating a public or secret key.
This variant wraps ValidationError and is produced by constructors like
PublicKey::new or
SecretKey::new when the provided string does
not conform to the expected format.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<GenerationError> for Error
impl From<GenerationError> for Error
Source§fn from(source: GenerationError) -> Self
fn from(source: GenerationError) -> Self
Converts to this type from the input type.
Source§impl From<ValidationError> for Error
impl From<ValidationError> for Error
Source§fn from(source: ValidationError) -> Self
fn from(source: ValidationError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more