pub enum IrErrorCode {
ParseError,
InvalidRequest,
MethodNotFound,
InvalidParams,
InternalError,
Implementation(i64),
Other(i64),
}Expand description
A JSON-RPC error code.
Variants§
ParseError
-32700, invalid JSON.
InvalidRequest
-32600, the envelope was not a valid request object.
MethodNotFound
-32601, the method does not exist.
InvalidParams
-32602, the params did not match the method.
InternalError
-32603, an internal error.
Implementation(i64)
A code in the implementation-defined -32000..=-32099 range.
The raw code, not an offset into the range. Storing the code means
code and from_code are both an identity, so there is no arithmetic
to get backwards and no narrowing cast to make: the range runs
downwards from -32000, and a representation that hid that as an
offset is exactly the kind of thing that ends up adding instead of
subtracting and putting offset 99 at -31901, outside the reserved
range.
Other(i64)
A code outside every range the spec reserves.
Implementations§
Source§impl IrErrorCode
impl IrErrorCode
Sourcepub const UNSUPPORTED_PROTOCOL_VERSION: Self
pub const UNSUPPORTED_PROTOCOL_VERSION: Self
-32022, SEP-2575’s unsupported-protocol-version code.
Named rather than written at each use because the specification gives
it meaning rather than just a number: it is the code that carries
data.supported, so a client knows to retry against a revision this
server speaks instead of hunting for a bug in its own request. A bare
-32022 at a call site reads as a typo, and this one is easy to typo.
It lives in the implementation-defined range, which is why it is
Implementation and not a named variant of its
own: a new variant would be a promise that no other code can hold,
since nothing stops a peer sending this number for an unrelated reason.
Sourcepub const HEADER_MISMATCH: Self
pub const HEADER_MISMATCH: Self
-32020, HeaderMismatchError (2026-07-28).
An HTTP header disagrees with the body it describes, or a required one
is missing. Renumbered from -32001 when the revision partitioned the
server-error range; see that revision’s changelog, minor change 12.
Sourcepub const MISSING_REQUIRED_CLIENT_CAPABILITY: Self
pub const MISSING_REQUIRED_CLIENT_CAPABILITY: Self
-32021, MissingRequiredClientCapabilityError (2026-07-28).
Serving the request needs a capability the client did not declare in
its per-request clientCapabilities. Carries
data.requiredCapabilities, a ClientCapabilities object.