#[non_exhaustive]#[repr(i32)]pub enum ErrorCode {
Show 24 variants
ParseError = -32_700,
InvalidRequest = -32_600,
MethodNotFound = -32_601,
InvalidParams = -32_602,
InternalError = -32_603,
ServerError = -32_000,
ContentMissRateLimited = -32_003,
ResourceUnavailable = -32_004,
RootNotAnchored = -32_005,
PeerUnreachable = -32_006,
RangeNotSatisfiable = -32_007,
ContentRedirect = -32_008,
RangeMetadataUnrepresentable = -32_009,
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).
ContentMissRateLimited = -32_003
This node does not hold the content, and the requestor has exhausted its miss-lookup budget. Unlike an ordinary content miss (an indistinguishable decoy that is never an error), this is an explicit rate-limit signal: the requestor has spent its budget of miss lookups and should back off rather than keep probing.
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.
RangeMetadataUnrepresentable = -32_009
dig.fetchRange: the resource’s own range metadata cannot be represented
in a conforming frame at all, so this holder can NEVER serve the range.
A resource whose chunk_lens layout or inclusion_proof exceeds the
per-frame bounds has no conforming first frame, even with a paged prologue.
That is a permanent property of the resource, not a transient condition, so
it needs its own code: a client that could not tell it from an ordinary
transport failure would keep retrying a holder that cannot succeed, and would
retry every other holder of the same resource for the same reason.
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).
Trait Implementations§
impl Copy for ErrorCode
Source§impl<'de> Deserialize<'de> for ErrorCode
impl<'de> Deserialize<'de> for ErrorCode
Source§fn deserialize<D>(
deserializer: D,
) -> Result<ErrorCode, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<ErrorCode, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for ErrorCode
Source§impl Serialize for ErrorCode
impl Serialize for ErrorCode
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl StructuralPartialEq for ErrorCode
Auto Trait Implementations§
impl Freeze for ErrorCode
impl RefUnwindSafe for ErrorCode
impl Send for ErrorCode
impl Sync for ErrorCode
impl Unpin for ErrorCode
impl UnsafeUnpin for ErrorCode
impl UnwindSafe for ErrorCode
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.