#[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
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).
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).
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].
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
impl ErrorCode
Sourcepub const ALL: &'static [ErrorCode]
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.
Sourcepub const fn machine_code(self) -> &'static str
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.
Sourcepub const fn default_message(self) -> &'static str
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).
Sourcepub const fn default_origin(self) -> ErrorOrigin
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.
Sourcepub const fn is_jsonrpc_reserved(self) -> bool
pub const fn is_jsonrpc_reserved(self) -> bool
Whether this variant is in the JSON-RPC-reserved range
(-32768..=-32000).