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