rpc: return error code for eth_getWork when no work ready

This commit is contained in:
Gustav Simonsson
2015-08-26 12:46:50 +02:00
parent abce09954b
commit 829201382b
4 changed files with 28 additions and 4 deletions

View File

@ -94,6 +94,9 @@ func NewRpcResponse(id interface{}, jsonrpcver string, reply interface{}, err er
case *NotImplementedError:
jsonerr := &ErrorObject{-32601, err.Error()}
response = &ErrorResponse{Jsonrpc: jsonrpcver, Id: id, Error: jsonerr}
case *NotReadyError:
jsonerr := &ErrorObject{-32000, err.Error()}
response = &ErrorResponse{Jsonrpc: jsonrpcver, Id: id, Error: jsonerr}
case *DecodeParamError, *InsufficientParamsError, *ValidationError, *InvalidTypeError:
jsonerr := &ErrorObject{-32602, err.Error()}
response = &ErrorResponse{Jsonrpc: jsonrpcver, Id: id, Error: jsonerr}