mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
show RPC error message in console
This commit is contained in:
parent
483041eaa5
commit
f9b36e4acf
1 changed files with 2 additions and 2 deletions
|
|
@ -34,9 +34,7 @@ func (self *Jeth) err(call otto.FunctionCall, code int, msg string, id interface
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Jeth) Send(call otto.FunctionCall) (response otto.Value) {
|
func (self *Jeth) Send(call otto.FunctionCall) (response otto.Value) {
|
||||||
|
|
||||||
reqif, err := call.Argument(0).Export()
|
reqif, err := call.Argument(0).Export()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return self.err(call, -32700, err.Error(), nil)
|
return self.err(call, -32700, err.Error(), nil)
|
||||||
}
|
}
|
||||||
|
|
@ -85,6 +83,8 @@ func (self *Jeth) Send(call otto.FunctionCall) (response otto.Value) {
|
||||||
ret_response[response_idx] = { jsonrpc: ret_jsonrpc, id: ret_id, result: JSON.parse(ret_result) };
|
ret_response[response_idx] = { jsonrpc: ret_jsonrpc, id: ret_id, result: JSON.parse(ret_result) };
|
||||||
`)
|
`)
|
||||||
} else if res, ok := respif.(shared.ErrorResponse); ok {
|
} else if res, ok := respif.(shared.ErrorResponse); ok {
|
||||||
|
fmt.Printf("Error: %s (%d)\n", res.Error.Message, res.Error.Code)
|
||||||
|
|
||||||
call.Otto.Set("ret_id", res.Id)
|
call.Otto.Set("ret_id", res.Id)
|
||||||
call.Otto.Set("ret_jsonrpc", res.Jsonrpc)
|
call.Otto.Set("ret_jsonrpc", res.Jsonrpc)
|
||||||
call.Otto.Set("ret_error", res.Error)
|
call.Otto.Set("ret_error", res.Error)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue