-
Notifications
You must be signed in to change notification settings - Fork 1
Add per-method errors to openrpc.json spec #8
Copy link
Copy link
Open
Description
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
querymethods →RpcQueryError(13 variants)block/chunk→RpcBlockError(3 variants)send_tx/broadcast_tx_commit/broadcast_tx_async/tx→RpcTransactionError(6 variants)validators→RpcValidatorError(3 variants)
Reference
- Hand-written enums:
src/errors.rsin this repo - nearcore source of truth:
chain/jsonrpc-primitives/src/types/in nearcore
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels