pub enum Error {
Show 33 variants
WrongPasswordOrNotAVault,
TooSmall,
UnsupportedFormat(u8),
AlreadyExists(PathBuf),
ChangedOnDisk(PathBuf),
PolicyNotOffered,
ItemNotFound(i64),
NotFound(String),
Ambiguous {
reference: String,
candidates: Vec<ItemSummary>,
},
ItemKindMismatch {
id: i64,
actual: String,
expected: String,
},
UnknownItemKind {
id: i64,
kind: String,
},
VersionNotFound {
id: i64,
version: String,
},
FieldNotInVersion {
name: String,
available: Vec<String>,
},
UnreadableVersion,
UnsupportedExport(u32),
UnrecognizedImport,
UnreadableImport {
format: &'static str,
reason: String,
},
SealedImport {
format: &'static str,
advice: &'static str,
},
Unexportable {
title: String,
format: &'static str,
reason: String,
},
MalformedExport {
index: usize,
reason: String,
},
PluginUnusable {
name: String,
reason: String,
},
PluginFailed {
name: String,
reason: String,
},
KeyDerivation,
Random,
GeneratorLength {
length: usize,
minimum: usize,
maximum: usize,
unit: &'static str,
},
InvalidOtpKey(&'static str),
UnreadableExpiry(String),
Clipboard(String),
KeysGone,
KeysChanged,
PasswordNeeded,
Io {
context: String,
source: Error,
},
Db(Error),
}Expand description
Everything that can go wrong while working with a vault.
Error messages never contain secret material: no passwords, no item contents, no attachment bytes.
Variants§
WrongPasswordOrNotAVault
The password did not decrypt the vault, or the file is not a vault at all. These two cases are indistinguishable by design: an unauthenticated blob carries nothing to tell them apart.
TooSmall
The file is too short to hold a salt, a nonce and an authentication tag.
UnsupportedFormat(u8)
The decrypted payload declares a format version this build cannot read.
AlreadyExists(PathBuf)
The vault file exists and would be overwritten.
ChangedOnDisk(PathBuf)
The vault’s file is no longer the version this value read: something else wrote it, or removed it. Nothing was written over it.
PolicyNotOffered
A vault can only be set to the values on offer (crate::policy).
ItemNotFound(i64)
The requested item is not in the vault.
NotFound(String)
Nothing in the vault matches what the user asked for.
Ambiguous
More than one item matches, so the caller has to narrow it down.
The candidates travel with the error to be shown to the user; they carry item titles, so treat them as vault contents rather than log material.
Fields
candidates: Vec<ItemSummary>Every item it could have meant.
ItemKindMismatch
The requested item does not hold the kind of payload asked for.
Fields
UnknownItemKind
The item was written by a newer sefy, which knows a kind this one does not.
Reading its contents, editing it or extracting it would all mean guessing at a shape this build has never seen. Listing, searching, exporting and merging work regardless: those need the item’s identity, not its meaning.
VersionNotFound
The item has no earlier version by that identity.
FieldNotInVersion
A version asked to give back one field did not have it.
Carries the names it did have, which are labels rather than values and safe to show.
UnreadableVersion
A kept version could not be read back.
Written by this build it cannot happen; a damaged or hand-edited database can, and the version is reported rather than read as empty.
UnsupportedExport(u32)
The export file declares a version this build cannot read.
UnrecognizedImport
The file handed to an import is none of the formats sefy reads.
UnreadableImport
The file looks like one of the formats sefy reads, but is not a usable one.
Fields
SealedImport
The file is an export another tool sealed under its own password, so its contents are not there to read.
Fields
Unexportable
An item holds something the chosen export format has no way to carry.
Fields
MalformedExport
An entry in an export is missing a field or holds something unusable.
Fields
PluginUnusable
A plugin was found but sefy will not run it.
Refusing before the call is deliberate: running a transport that cannot do what was asked turns a knowable mismatch into a failure the user has to interpret from someone else’s error message.
PluginFailed
A plugin ran and did not carry out the operation.
The reason comes from the plugin itself and is shown as given; a transport’s own output is never quoted back verbatim, since it may carry credentials for the remote.
KeyDerivation
Key derivation failed (only on absurd parameters or allocation failure).
Random
The operating system refused to provide random bytes.
GeneratorLength
A generated secret was asked to be shorter than its recipe allows, or longer than sefy generates.
Fields
InvalidOtpKey(&'static str)
What was offered as a one-time password key is not one.
The reason is one of a fixed set of phrases: the text itself is a secret and is never quoted back.
UnreadableExpiry(String)
What was offered as the date a record stops working is not one.
The text is quoted: a date is a public field, and seeing what was typed is the quickest way to see what is wrong with it.
Clipboard(String)
The clipboard could not be reached or written.
The message is the platform’s, which describes the clipboard and never what was being put on it.
KeysGone
Whoever holds the password has locked, or is no longer there.
KeysChanged
What was offered for sealing is not the password this vault was opened with: another agent took the place of the first, or the password typed when the first had gone was mistyped. Sealing under it would quietly move the vault to a password its owner is not thinking of.
PasswordNeeded
This takes the password itself, and the vault was opened through a key someone else derived.
Io
A filesystem operation failed.
Db(Error)
The embedded database rejected an operation.
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)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Forget for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more