Skip to content

[Feature] Add JsonRpcErrorClassifier for standardized error code interpretation #24

@limehee

Description

@limehee

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.

Metadata

Metadata

Assignees

Labels

type: featureNew feature specification and implementation.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions