Enum Error

Source
pub enum Error {
Show 31 variants AlreadyElided, AmbiguousPredicate, InvalidDigest, InvalidFormat, MissingDigest, NonexistentPredicate, NotWrapped, NotLeaf, NotAssertion, InvalidAssertion, InvalidAttachment, NonexistentAttachment, AmbiguousAttachment, AlreadyCompressed, NotCompressed, AlreadyEncrypted, NotEncrypted, NotKnownValue, UnknownRecipient, UnknownSecret, UnverifiedSignature, InvalidOuterSignatureType, InvalidInnerSignatureType, UnverifiedInnerSignature, InvalidSignatureType, InvalidShares, InvalidType, AmbiguousType, UnexpectedResponseID, InvalidResponse, DCBOR(Error),
}
Expand description

Error types returned when operating on Gordian Envelopes.

These errors capture various conditions that can occur when working with envelopes, including structure validation, operation constraints, and extension-specific errors.

The errors are organized by category, reflecting the base envelope specification and various extensions defined in the Gordian Envelope Internet Draft and Blockchain Commons Research (BCR) documents.

Variants§

§

AlreadyElided

Returned when attempting to compress or encrypt an envelope that has already been elided.

This error occurs because an elided envelope only contains a digest reference and no longer has a subject that can be compressed or encrypted.

§

AmbiguousPredicate

Returned when attempting to retrieve an assertion by predicate, but multiple matching assertions exist.

For queries that expect a single result (like object_for_predicate), having multiple matching assertions is ambiguous and requires more specific targeting.

§

InvalidDigest

Returned when a digest validation fails.

This can occur when unwrapping an envelope, verifying signatures, or other operations that rely on the integrity of envelope digests.

§

InvalidFormat

Returned when an envelope’s format is invalid.

This typically occurs during parsing or decoding of an envelope from CBOR.

§

MissingDigest

Returned when a digest is expected but not found.

This can occur when working with envelope structures that require digest information, such as when working with elided envelopes.

§

NonexistentPredicate

Returned when attempting to retrieve an assertion by predicate, but no matching assertion exists.

This error occurs with functions like object_for_predicate when the specified predicate doesn’t match any assertion in the envelope.

§

NotWrapped

Returned when attempting to unwrap an envelope that wasn’t wrapped.

This error occurs when calling Envelope::unwrap_envelope on an envelope that doesn’t have the wrapped format.

§

NotLeaf

Returned when expecting an envelope’s subject to be a leaf, but it isn’t.

This error occurs when calling methods that require access to a leaf value but the envelope’s subject is an assertion, node, or elided.

§

NotAssertion

Returned when expecting an envelope’s subject to be an assertion, but it isn’t.

This error occurs when calling methods that require an assertion structure but the envelope’s subject has a different format.

§

InvalidAssertion

Returned

§

InvalidAttachment

Returned when an attachment’s format is invalid.

This error occurs when an envelope contains an attachment with an invalid structure according to the Envelope Attachment specification (BCR-2023-006).

§

NonexistentAttachment

Returned when an attachment is requested but does not exist.

This error occurs when attempting to retrieve an attachment by ID that doesn’t exist in the envelope.

§

AmbiguousAttachment

Returned when multiple attachments match a single query.

This error occurs when multiple attachments have the same ID, making it ambiguous which attachment should be returned.

§

AlreadyCompressed

Returned when attempting to compress an envelope that is already compressed.

This error occurs when calling compression functions on an envelope that already has compressed content, as defined in BCR-2023-005.

§

NotCompressed

Returned when attempting to uncompress an envelope that is not compressed.

This error occurs when calling uncompression functions on an envelope that doesn’t contain compressed content.

§

AlreadyEncrypted

Returned when attempting to encrypt an envelope that is already encrypted or compressed.

This error occurs to prevent multiple layers of encryption or encryption of compressed data, which could reduce security, as defined in BCR-2023-004.

§

NotEncrypted

Returned when attempting to decrypt an envelope that is not encrypted.

This error occurs when calling decryption functions on an envelope that doesn’t contain encrypted content.

§

NotKnownValue

Returned when expecting an envelope’s subject to be a known value, but it isn’t.

This error occurs when calling methods that require a known value (as defined in BCR-2023-003) but the envelope’s subject is a different type.

§

UnknownRecipient

Returned when attempting to decrypt an envelope with a recipient that doesn’t match.

This error occurs when trying to use a private key to decrypt an envelope that wasn’t encrypted for the corresponding public key.

§

UnknownSecret

Returned when attempting to decrypt an envelope with a secret that doesn’t match.

This error occurs when trying to use a secret that does not correspond to the expected recipient, preventing successful decryption.

§

UnverifiedSignature

Returned when a signature verification fails.

This error occurs when a signature does not validate against its purported public key.

§

InvalidOuterSignatureType

Returned when the outer signature object type is not Signature.

§

InvalidInnerSignatureType

Returned when the inner signature object type is not Signature.

§

UnverifiedInnerSignature

Returned when the inner signature is not made with the same key as the outer signature.

§

InvalidSignatureType

Returned when the signature object is not a Signature.

§

InvalidShares

Returned when SSKR shares are invalid or insufficient for reconstruction.

This error occurs when attempting to join SSKR shares that are malformed, from different splits, or insufficient to meet the recovery threshold.

§

InvalidType

Returned when an envelope contains an invalid type.

This error occurs when an envelope’s type information doesn’t match the expected format or value.

§

AmbiguousType

Returned when an envelope contains ambiguous type information.

This error occurs when multiple type assertions exist that conflict with each other or create ambiguity about the envelope’s type.

§

UnexpectedResponseID

Returned when a response envelope has an unexpected ID.

This error occurs when processing a response envelope and the ID doesn’t match the expected request ID, as defined in BCR-2023-012.

§

InvalidResponse

Returned when a response envelope is invalid.

§

DCBOR(Error)

dcbor error

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 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> 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 = 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

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T