diff options
author | Bas van Kervel <bas@ethdev.com> | 2015-08-26 17:09:09 +0800 |
---|---|---|
committer | Bas van Kervel <bas@ethdev.com> | 2015-08-26 17:33:02 +0800 |
commit | f448310eef5abf1dfd10b25bfd22466cb5477dfd (patch) | |
tree | 2d2d07ecd4404e712cfe448197358b98278168cf /rpc/jeth.go | |
parent | abce09954b6901b446c004ee06b389c338922f28 (diff) | |
download | go-tangerine-f448310eef5abf1dfd10b25bfd22466cb5477dfd.tar.gz go-tangerine-f448310eef5abf1dfd10b25bfd22466cb5477dfd.tar.zst go-tangerine-f448310eef5abf1dfd10b25bfd22466cb5477dfd.zip |
bugfix console error handling
Diffstat (limited to 'rpc/jeth.go')
-rw-r--r-- | rpc/jeth.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/rpc/jeth.go b/rpc/jeth.go index 757f6b7eb..ae2603ae4 100644 --- a/rpc/jeth.go +++ b/rpc/jeth.go @@ -44,11 +44,12 @@ func NewJeth(ethApi shared.EthereumApi, re *jsre.JSRE, client comms.EthereumClie } func (self *Jeth) err(call otto.FunctionCall, code int, msg string, id interface{}) (response otto.Value) { - errObj := fmt.Sprintf("{\"message\": \"%s\", \"code\": %d}", msg, code) - retResponse := fmt.Sprintf("ret_response = JSON.parse('{\"jsonrpc\": \"%s\", \"id\": %v, \"error\": %s}');", shared.JsonRpcVersion, id, errObj) + m := shared.NewRpcErrorResponse(id, shared.JsonRpcVersion, code, fmt.Errorf(msg)) + errObj, _ := json.Marshal(m.Error) + errRes, _ := json.Marshal(m) - call.Otto.Run("ret_error = " + errObj) - res, _ := call.Otto.Run(retResponse) + call.Otto.Run("ret_error = " + string(errObj)) + res, _ := call.Otto.Run("ret_response = " + string(errRes)) return res } |