Problem statement
Applications consuming JSON-RPC responses repeatedly implement ad-hoc logic to interpret error.code values (standard vs server-range vs custom). This creates inconsistency and weakens interoperability.
Proposed solution
Add JsonRpcErrorClassifier utility in jsonrpc-core with:
- deterministic classification for integer error codes:
- standard (
-32700, -32600, -32601, -32602, -32603)
- server reserved range (
-32099..-32000)
- custom
- helper APIs for common checks (
isStandard, isServerRange, isCustom)
Alternatives considered
- Keep this as documentation-only guidance
- Let each integration own its own classifier logic
These alternatives do not provide a reusable canonical implementation.
JSON-RPC behavior impact
No protocol behavior change. This introduces a utility for response handling and diagnostics.
Additional context
- Ensure compatibility with existing
JsonRpcResponseErrorCodePolicy concepts.
- Add unit tests for boundaries and all standard code values.
Problem statement
Applications consuming JSON-RPC responses repeatedly implement ad-hoc logic to interpret
error.codevalues (standard vs server-range vs custom). This creates inconsistency and weakens interoperability.Proposed solution
Add
JsonRpcErrorClassifierutility injsonrpc-corewith:-32700,-32600,-32601,-32602,-32603)-32099..-32000)isStandard,isServerRange,isCustom)Alternatives considered
These alternatives do not provide a reusable canonical implementation.
JSON-RPC behavior impact
No protocol behavior change. This introduces a utility for response handling and diagnostics.
Additional context
JsonRpcResponseErrorCodePolicyconcepts.