Skip to main content

Error

Enum Error 

Source
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

§reference: String

What the user typed.

§candidates: Vec<ItemSummary>

Every item it could have meant.

§

ItemKindMismatch

The requested item does not hold the kind of payload asked for.

Fields

§id: i64

Item that was addressed.

§actual: String

Kind the item actually has.

§expected: String

Kind the caller asked for.

§

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.

Fields

§id: i64

Item that was addressed.

§kind: String

The name the kind was stored under.

§

VersionNotFound

The item has no earlier version by that identity.

Fields

§id: i64

Item that was addressed.

§version: String

Identity of the version asked for.

§

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.

Fields

§name: String

The field asked for.

§available: Vec<String>

The fields the version did hold.

§

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

§format: &'static str

What the file looked like, as in “a KeePass XML export”.

§reason: String

What is wrong with it, without quoting anything secret.

§

SealedImport

The file is an export another tool sealed under its own password, so its contents are not there to read.

Fields

§format: &'static str

What the file is, as in “Bitwarden export”.

§advice: &'static str

How to get one that is not.

§

Unexportable

An item holds something the chosen export format has no way to carry.

Fields

§title: String

The item’s title.

§format: &'static str

The format being written, as in “KeePass XML”.

§reason: String

What it holds that the format cannot.

§

MalformedExport

An entry in an export is missing a field or holds something unusable.

Fields

§index: usize

Position of the offending entry, counting from zero.

§reason: String

What is wrong with it, without quoting the item’s contents.

§

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.

Fields

§name: String

Short name of the plugin.

§reason: String

Why it will not be run.

§

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.

Fields

§name: String

Short name of the plugin.

§reason: String

What the plugin said went wrong.

§

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

§length: usize

What was asked for.

§minimum: usize

The fewest the recipe can work with.

§maximum: usize

The most sefy generates.

§unit: &'static str

What is being counted: characters or words.

§

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.

Fields

§context: String

What was being attempted.

§source: Error

Underlying OS error.

§

Db(Error)

The embedded database rejected an operation.

Trait Implementations§

Source§

impl Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.