Skip to main content

StandardCode

Enum StandardCode 

Source
#[non_exhaustive]
pub enum StandardCode {
Show 16 variants MalformedRequest, UnsupportedType, UnsupportedVersion, Expired, ProofRequired, ProofInvalid, PermissionDenied, WrongRecipient, IdentityMismatch, IdConflict, Cancelled, TaskFailed, Unavailable, InternalError, UnsupportedExtension, Indeterminate,
}
Expand description

The framework-defined standard error codes (SPEC.md §8.3).

Marked #[non_exhaustive] as of 0.7.0: the framework adds a standard code from time to time (idConflict in 0.4), and without this every such addition would be a breaking change for any downstream match. Downstream code must carry a wildcard arm; in exchange, future codes arrive as a minor bump rather than a major one.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

MalformedRequest

The document did not validate against the framework schema or the task-specific payload schema.

§

UnsupportedType

The consumer does not recognize the type URI.

§

UnsupportedVersion

The type URI was recognized but its MAJOR.MINOR is not supported.

§

Expired

expiresAt was in the past at the time of evaluation.

§

ProofRequired

A proof was required and was missing.

§

ProofInvalid

A proof was present but failed verification.

§

PermissionDenied

The requesting party is not authorized to invoke this task.

§

WrongRecipient

The document’s recipient does not identify the receiving consumer.

§

IdentityMismatch

An in-band issuer or recipient is inconsistent with the transport- authenticated identity for the same party.

§

IdConflict

The document’s id matches one the consumer has already accepted, but its content differs (SPEC.md §7.2 item 11).

§

Cancelled

The consumer stopped the task on its own initiative — operator action, policy, capacity, or a compliance hold (SPEC.md §11). Distinct from a producer-requested cancellation, which is answered by a response to the trust-task-control document rather than by an error.

§

TaskFailed

The recipient party attempted the task and could not complete it.

§

Unavailable

The recipient party is temporarily unable to process the task.

§

InternalError

The recipient party encountered an unexpected internal failure.

§

UnsupportedExtension

The document named a namespace critical under extCritical that the consumer does not recognize (SPEC.md §4.5.2). The consumer understood the type and its version, and refused rather than process the document without the namespace. New in trust-task-error/0.6.

§

Indeterminate

The recipient party could not decide, because something it needed and does not control could not be obtained or checked: the schema behind a type, the material behind a verificationMethod, a status list, or a referenced document whose digest no longer matches (SPEC.md §8.3). Neither a refusal nor a failed verification: a party retaining it must not read it as either. New in trust-task-error/0.6.

Implementations§

Source§

impl StandardCode

Source

pub fn default_retryable(self) -> bool

The default retryable value an emitter SHOULD use per SPEC.md §8.3, unless task-specific knowledge dictates otherwise.

TaskFailed is varies in the spec; we treat its default as false.

Source

pub fn as_str(self) -> &'static str

The wire-form string this code is emitted as.

As of framework 0.2 the standard codes are lowerCamelCase (SPEC.md §8.3 / Appendix B). parse_standard still accepts the framework 0.1 snake_case spellings so a 0.2 consumer can read a 0.1 peer.

Trait Implementations§

Source§

impl Clone for StandardCode

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for StandardCode

Source§

impl Debug for StandardCode

Source§

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

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

impl Display for StandardCode

Source§

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

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

impl Eq for StandardCode

Source§

impl From<StandardCode> for ErrorPayload

Source§

fn from(code: StandardCode) -> Self

Converts to this type from the input type.
Source§

impl From<StandardCode> for TrustTaskCode

Source§

fn from(code: StandardCode) -> Self

Converts to this type from the input type.
Source§

impl Hash for StandardCode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for StandardCode

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for StandardCode

Auto Trait Implementations§

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> AsOut<T> for T
where T: Copy,

Source§

fn as_out(&mut self) -> Out<'_, T>

Returns an out reference to self.
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.