mirror of https://github.com/ethereum/go-ethereum
rpc: improve error codes for internal server errors (#25678)
This changes the error code returned by the RPC server in certain situations: - handler panic: code -32603 - result marshaling error: code -32603 - attempt to subscribe via HTTP: code -32001 In all of the above cases, the server previously returned the default error code -32000. Co-authored-by: Nicholas Zhao <nicholas.zhao@gmail.com> Co-authored-by: Felix Lange <fjl@twurst.com>pull/25729/head
parent
06151eb581
commit
610cf02c4a
@ -0,0 +1,7 @@ |
||||
// These tests trigger various 'internal error' conditions.
|
||||
|
||||
--> {"jsonrpc":"2.0","id":1,"method":"test_marshalError","params": []} |
||||
<-- {"jsonrpc":"2.0","id":1,"error":{"code":-32603,"message":"json: error calling MarshalText for type *rpc.MarshalErrObj: marshal error"}} |
||||
|
||||
--> {"jsonrpc":"2.0","id":2,"method":"test_panic","params": []} |
||||
<-- {"jsonrpc":"2.0","id":2,"error":{"code":-32603,"message":"method handler crashed"}} |
Loading…
Reference in new issue