diff options
Diffstat (limited to 'rpc/shared')
-rw-r--r-- | rpc/shared/types.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/rpc/shared/types.go b/rpc/shared/types.go index 600d39541..6a29fa88e 100644 --- a/rpc/shared/types.go +++ b/rpc/shared/types.go @@ -2,6 +2,7 @@ package shared import ( "encoding/json" + "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" ) @@ -45,15 +46,15 @@ func NewRpcResponse(id interface{}, jsonrpcver string, reply interface{}, err er var response interface{} switch err.(type) { - case nil: + case nil: response = &SuccessResponse{Jsonrpc: jsonrpcver, Id: id, Result: reply} - case *NotImplementedError: + case *NotImplementedError: jsonerr := &ErrorObject{-32601, err.Error()} response = &ErrorResponse{Jsonrpc: jsonrpcver, Id: id, Error: jsonerr} - case *DecodeParamError, *InsufficientParamsError, *ValidationError, *InvalidTypeError: + case *DecodeParamError, *InsufficientParamsError, *ValidationError, *InvalidTypeError: jsonerr := &ErrorObject{-32602, err.Error()} response = &ErrorResponse{Jsonrpc: jsonrpcver, Id: id, Error: jsonerr} - default: + default: jsonerr := &ErrorObject{-32603, err.Error()} response = &ErrorResponse{Jsonrpc: jsonrpcver, Id: id, Error: jsonerr} } |