Skip to main content

Code

Enum Code 

Source
pub enum Code {
Show 27 variants UnknownKey, MalformedOp, MalformedRequest, ReviewerMismatch, ChannelNotOwned, NodeOnly, AssignmentRequired, ProtectedRef, ReviewRequired, RefUndeletable, StaleHead, ReviewState, ProvenanceState, ChangeState, WorkspaceState, IdentityState, VouchState, WitnessState, PolicyUnavailable, LogEvicted, DuplicateSubmission, ScopeRequired, ForeignScope, StaleScope, QuotaExceeded, BadSignature, Unclassified,
}
Expand description

Stable, machine-readable rejection reasons.

A code is a contract: clients branch on it, so renaming one is a breaking change and adding one is not. Every variant is listed in ERRORS.md with the action a client should take.

Variants§

§

UnknownKey

The signature names a key id this node has no record of. Says nothing about the signature itself, which is not checked once the key is missing.

§

MalformedOp

The payload did not decode as a ViewOp.

§

MalformedRequest

The request body was missing fields or badly encoded.

§

ReviewerMismatch

A verdict or comment claimed an attribution other than the signed channel.

§

ChannelNotOwned

The signing key is bound to a different channel name.

§

NodeOnly

Only the node’s own key may author this operation.

§

AssignmentRequired

The node assigns reviewers; a self-named list was refused.

§

ProtectedRef

The target ref is protected and needs a node-drawn reviewer list.

§

ReviewRequired

The target ref lacks the required independent approval weight.

§

RefUndeletable

The target ref is protected and cannot be deleted.

§

StaleHead

Compare-and-swap failed: the state moved under the submission.

§

ReviewState

A review-op precondition failed (duplicate id, unknown review, already assigned, archived).

§

ProvenanceState

A provenance record was missing a subject or kind.

§

ChangeState

A stable change was unknown, duplicated, archived, or mismatched.

§

WorkspaceState

A workspace lifecycle request conflicted with its durable binding.

§

IdentityState

A key-binding precondition failed (a key already bound to another operator, a revoked or unbound key, a channel naming a different operator).

§

VouchState

A vouch precondition failed (an end with no unrevoked binding, a self-vouch, an edge that already stands, or a withdrawal of one that does not).

§

WitnessState

A witness precondition failed (a witness with no unrevoked binding, a cosignature over anything but the latest ref-state attestation, or one that witness has already made).

§

PolicyUnavailable

The operator’s protected-ref list could not be read, so the gate failed closed.

§

LogEvicted

Requested log entries are older than anything this node can serve.

§

DuplicateSubmission

These exact signed bytes have already been admitted.

§

ScopeRequired

This node requires a signed scope and the op carried none.

§

ForeignScope

The op was signed for a different node’s log.

§

StaleScope

The scoped head is no longer recent enough to admit.

§

QuotaExceeded

A per-user quota (D37) was already full, or this request was larger than one is allowed to be.

§

BadSignature

The signature does not verify under the key it names, which this node does trust. Distinct from Code::UnknownKey because the repairs are opposites: that one widens the trusted set, this one must not.

§

Unclassified

Anything that did not originate as a structured rejection.

Implementations§

Source§

impl Code

Source

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

The stable wire string. Written out rather than derived from the variant name so renaming the Rust identifier cannot silently change the contract.

Source

pub fn all() -> &'static [Code]

Every code, for the docs generator and the coverage test.

Source§

impl Code

Source

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

One-line meaning, for the ERRORS.md table.

Source

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

What a client should do on receipt. One row of ERRORS.md.

Trait Implementations§

Source§

impl Clone for Code

Source§

fn clone(&self) -> Code

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 Debug for Code

Source§

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

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

impl PartialEq for Code

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Code

Source§

impl Eq for Code

Source§

impl StructuralPartialEq for Code

Auto Trait Implementations§

§

impl Freeze for Code

§

impl RefUnwindSafe for Code

§

impl Send for Code

§

impl Sync for Code

§

impl Unpin for Code

§

impl UnsafeUnpin for Code

§

impl UnwindSafe for Code

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