Error

Enum Error 

Source
pub enum Error {
    KeyNotFound {
        key_id: String,
        operation: String,
    },
    KeyExpired {
        key_id: String,
        expired_at: SystemTime,
    },
    InvalidKeyState {
        key_id: String,
        state: String,
        operation: String,
    },
    CryptoError {
        operation: String,
        message: String,
        key_id: Option<String>,
    },
    StorageError {
        operation: String,
        message: String,
        path: Option<String>,
    },
    InsufficientEntropy {
        operation: String,
    },
    RotationFailed {
        key_id: String,
        reason: String,
    },
    SerializationError {
        operation: String,
        message: String,
    },
    IoError {
        operation: String,
        source: Error,
    },
    AuthenticationFailed {
        reason: String,
        attempts: Option<u32>,
    },
    ConfigurationError {
        message: String,
    },
}
Expand description

rust-keyvault error type with enhanced context

Variants§

§

KeyNotFound

Key not found in storage

Fields

§key_id: String

The ID of the key that was not found

§operation: String

The operation that was attempting to access the key

§

KeyExpired

Key has expired

Fields

§key_id: String

The ID of the expired key

§expired_at: SystemTime

When the key expired

§

InvalidKeyState

Key is in the wrong state for requested operation

Fields

§key_id: String

The ID of the key with invalid state

§state: String

The current state of the key

§operation: String

The operation that was attempted

§

CryptoError

Cryptographic operation failed

Fields

§operation: String

The operation that was being performed when the error occurred

§message: String

Detailed error message

§key_id: Option<String>

Optional key ID involved in the operation

§

StorageError

Storage backend failed

Fields

§operation: String

The operation that was being performed when the error occurred

§message: String

Detailed error message

§path: Option<String>

Optional filesystem path involved in the operation

§

InsufficientEntropy

Insufficient entropy available

Fields

§operation: String

The operation that required entropy

§

RotationFailed

Key rotation failed

Fields

§key_id: String

The ID of the key that failed to rotate

§reason: String

The reason rotation failed

§

SerializationError

Serialization/deserialization error

Fields

§operation: String

The serialization operation that failed

§message: String

Detailed error message

§

IoError

Generic I/O error with context

Fields

§operation: String

The I/O operation that failed

§source: Error

The underlying I/O error

§

AuthenticationFailed

Authentication failed

Fields

§reason: String

The reason authentication failed

§attempts: Option<u32>

Number of failed attempts, if tracked

§

ConfigurationError

Configuration error

Fields

§message: String

Description of the configuration problem

Implementations§

Source§

impl Error

Source

pub fn code(&self) -> ErrorCode

Get the error code for programmatic handling

Source

pub fn crypto<S: Into<String>>(operation: S, message: S) -> Self

Create a crypto error with context

Source

pub fn crypto_with_key<S: Into<String>>( operation: S, message: S, key_id: S, ) -> Self

Create a crypto error with key context

Source

pub fn storage<S: Into<String>>(operation: S, message: S) -> Self

Create a storage error with context

Source

pub fn storage_with_path<S: Into<String>>( operation: S, message: S, path: S, ) -> Self

Create a storage error with path context

Source

pub fn is_retryable(&self) -> bool

Check if error is retryable

Source

pub fn is_auth_failure(&self) -> bool

Check if error is a authentication failure

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(err: Error) -> 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 !UnwindSafe 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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V