Wrap unknown RPC errors (#10793)

This commit is contained in:
terencechain 2022-06-01 09:46:07 -07:00 committed by GitHub
parent bc91d63fcf
commit 2bc3ef29e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -307,7 +307,7 @@ func handleRPCError(err error) error {
"here https://docs.prylabs.network/docs/execution-node/authentication")
return fmt.Errorf("could not authenticate connection to execution client: %v", err)
}
return fmt.Errorf("got an unexpected error in JSON-RPC response: %v", err)
return errors.Wrapf(err, "got an unexpected error in JSON-RPC response")
}
switch e.ErrorCode() {
case -32700:
@ -330,7 +330,7 @@ func handleRPCError(err error) error {
// Only -32000 status codes are data errors in the RPC specification.
errWithData, ok := err.(rpc.DataError)
if !ok {
return fmt.Errorf("got an unexpected error in JSON-RPC response: %v", err)
return errors.Wrapf(err, "got an unexpected error in JSON-RPC response")
}
return errors.Wrapf(ErrServer, "%v", errWithData.ErrorData())
default: