Skip to main content

ErrorCode

Enum ErrorCode 

Source
#[non_exhaustive]
#[repr(i32)]
pub enum ErrorCode {
Show 22 variants ParseError = -32_700, InvalidRequest = -32_600, MethodNotFound = -32_601, InvalidParams = -32_602, InternalError = -32_603, ServerError = -32_000, ResourceUnavailable = -32_004, RootNotAnchored = -32_005, PeerUnreachable = -32_006, RangeNotSatisfiable = -32_007, ContentRedirect = -32_008, UpstreamError = -32_010, StageInvalidInput = -32_011, StageNoFiles = -32_012, StageOverCap = -32_013, StageCompileFailed = -32_014, OnionCircuitUnavailable = -32_020, PrivacyRequiresLocalNode = -32_021, OnionHopsOutOfRange = -32_022, Unauthorized = -32_030, NotSupported = -32_031, ControlError = -32_032,
}
Expand description

A canonical DIG-node RPC error code.

Serializes as a bare integer (via serde_repr), spec-compliant for error.code. #[non_exhaustive] so adding a code in a minor release is additive; downstream matches must use _ => ….

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

ParseError = -32_700

Invalid JSON was received by the server.

§

InvalidRequest = -32_600

The JSON sent is not a valid Request object.

§

MethodNotFound = -32_601

The method does not exist / is not available.

§

InvalidParams = -32_602

Invalid method parameter(s).

§

InternalError = -32_603

The node failed to satisfy a well-formed call (network profile).

§

ServerError = -32_000

Generic server error (config write failure, file I/O, chain read failure).

§

ResourceUnavailable = -32_004

Resource not available at the requested root — a genuine infrastructure miss (absent module, bad magic, oversize, a trap, an undecodable envelope). Distinct from a content miss, which is an indistinguishable decoy and is never an error.

§

RootNotAnchored = -32_005

The requested or served generation is not the store’s current on-chain root. The read path pins to the CHIP-0035 singleton’s on-chain root and fails closed rather than serving an unverified generation.

§

PeerUnreachable = -32_006

No connection to the named peer could be established — every NAT-traversal strategy failed, or the peer is not on this network.

§

RangeNotSatisfiable = -32_007

The requested byte range lies outside the resource (offset >= total_length) or is otherwise unsatisfiable.

§

ContentRedirect = -32_008

This node does not hold the content but located peers that do. data.redirect names the holders + the redirect budget.

§

UpstreamError = -32_010

An upstream/proxy fetch (e.g. rpc.dig.net) failed. Distinct from the generic ServerError so a client can tell an upstream fault from a local one.

§

StageInvalidInput = -32_011

dig.stage: the input directory is unreadable, or the bounded walk exceeded its byte / file-count / depth budget.

§

StageNoFiles = -32_012

dig.stage: the input directory contained no files to compile.

§

StageOverCap = -32_013

dig.stage: the input exceeds the per-store size cap.

§

StageCompileFailed = -32_014

dig.stage: compiling the capsule failed (CLVM/IO error).

§

OnionCircuitUnavailable = -32_020

A mode:"privacy" read could not be served privately (no circuit could be built, or one died mid-fetch). The node fails closed rather than downgrading — a silent downgrade would deanonymize the reader.

§

PrivacyRequiresLocalNode = -32_021

mode:"privacy" was requested but the caller is not the node’s own trusted local originator. Privacy requires a local DIG node.

§

OnionHopsOutOfRange = -32_022

The requested privacy.hops (circuit length) is outside [2, 5].

§

Unauthorized = -32_030

The control-plane call is not authorized (loopback / token gate failed).

§

NotSupported = -32_031

The control-plane method is recognized but not supported on this node.

§

ControlError = -32_032

A control-plane runtime error (pin registry, sync trigger, config write).

Implementations§

Source§

impl ErrorCode

Source

pub const ALL: &'static [ErrorCode]

Every code, in wire order. Drives the OpenRPC error catalogue and the exhaustiveness conformance test — a new variant must be added here.

Source

pub const fn code(self) -> i32

The raw integer wire code.

Source

pub const fn machine_code(self) -> &'static str

The stable UPPER_SNAKE_CASE machine identifier carried in data.code.

This is the branch key an agent keys on; it never changes once assigned.

Source

pub const fn default_message(self) -> &'static str

The default human-readable summary for this code (used when a caller does not supply a more specific message).

Source

pub const fn default_origin(self) -> ErrorOrigin

The natural ErrorOrigin for this code (which subsystem the failure arose in). A caller may override it — a ResourceUnavailable bubbled up from an upstream proxy can be tagged ErrorOrigin::Upstream.

Source

pub const fn is_jsonrpc_reserved(self) -> bool

Whether this variant is in the JSON-RPC-reserved range (-32768..=-32000).

Trait Implementations§

Source§

impl Clone for ErrorCode

Source§

fn clone(&self) -> ErrorCode

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 ErrorCode

Source§

impl Debug for ErrorCode

Source§

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

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

impl<'de> Deserialize<'de> for ErrorCode

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ErrorCode

Source§

impl Hash for ErrorCode

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 ErrorCode

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for ErrorCode

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ErrorCode

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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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