Skip to content

Add per-method errors to openrpc.json spec #8

@r-near

Description

@r-near

Context

The errors module (src/errors.rs) now contains hand-written per-method RPC error enums (RpcQueryError, RpcBlockError, RpcTransactionError, RpcValidatorError) that match nearcore's chain/jsonrpc-primitives types. These were written by hand because the OpenRPC spec (openrpc.json) currently has no method-level error definitions — every method shows "no errors defined".

Goal

Add errors fields to each method definition in openrpc.json so these types can be auto-generated by the build script instead of maintained manually. The error shapes follow nearcore's #[serde(tag = "name", content = "info", rename_all = "SCREAMING_SNAKE_CASE")] convention.

Methods that need errors defined

  • query methods → RpcQueryError (13 variants)
  • block / chunkRpcBlockError (3 variants)
  • send_tx / broadcast_tx_commit / broadcast_tx_async / txRpcTransactionError (6 variants)
  • validatorsRpcValidatorError (3 variants)

Reference

  • Hand-written enums: src/errors.rs in this repo
  • nearcore source of truth: chain/jsonrpc-primitives/src/types/ in nearcore

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions