Unverified Commit ecdf3439 authored by Alexandru Vasile's avatar Alexandru Vasile Committed by GitHub
Browse files

chainHead: Backport error codes from spec (#2539)

This PR backports the error codes from the spec.

This relies on two specs for defining the error codes:
- Our rpc-spec-v2 https://github.com/paritytech/json-rpc-interface-spec.
- JSON-RPC spec https://www.jsonrpc.org/specification#error_object.

To better describe the error codes, they are divided into two separate
modules `rpc_spec_v2` and `json_rpc_spec` respectively.

The `InvalidSubscriptionID` and `FetchBlockHeader` are merged into the
JSON-RPC spec `INTERNAL_ERROR`.
While the other error codes are adjusted from spec.

Errors that are currently in use:
- -32801 block hash not reported by chainHead_follow or block hash has
been unpinned
- -32802 chainHead_follow started with withRuntime == false
- -32803 chainHead_follow did not generate an
operationWaitingForContinue event

The following are errors defined in the [JSON-RPC
spec](https://www.jsonrpc.org/specification#error_object):
- -32602 The provided parameter isn't one of the expected values, has
different format or is missing
- -32603 Internal server error

Note: Error `-32801` must be introduced and generated by the outstanding
https://github.com/paritytech/polkadot-sdk/issues/1505

Closes: https://github.com/paritytech/polkadot-sdk/issues/2530



---------

Signed-off-by: default avatarAlexandru Vasile <[email protected]>
parent eb46b99b
Pipeline #419955 passed with stages
in 46 minutes and 26 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment