The JSONRPC specification allows applications to specify their own error codes. Today all handler methods in the RPCAPI module catch exceptions at their top level and generate errors with the generic code -32603 (Internal error).
We should:
- Pick a small set of error states that we want to generate application defined error responses for.
- Update the "Error reporting" section in the API document to include those error states.
For each error state we should also:
- Create a class method named after its message string in lower snake case. This method should return a data structure that represents an JSONRPC error object for this error state. If the error state has a described data type, the method should take appropriate arguments so the data member of the error object can be properly populated.
- Make sure this error state throws an exception that can be recognized in a reliable way.
- Determine all handler methods where this exception can end up.
- Update exactly those handler methods to recognize the exception. When such an exception is recognized, the class method should be used to create an error object so the application defined error response can be returned instead of the generic -32603 response.
The JSONRPC specification allows applications to specify their own error codes. Today all handler methods in the RPCAPI module catch exceptions at their top level and generate errors with the generic code -32603 (Internal error).
We should:
For each error state we should also: