mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Fix RPC return value handling error
This commit is contained in:
parent
fceeac8585
commit
95a7e8301c
1 changed files with 8 additions and 1 deletions
|
|
@ -440,7 +440,14 @@ func (b *bridge) Send(call goja.FunctionCall) (response goja.Value) {
|
||||||
// raw message for some reason.
|
// raw message for some reason.
|
||||||
resp.Set("result", goja.Null())
|
resp.Set("result", goja.Null())
|
||||||
} else {
|
} else {
|
||||||
resultVal, err := b.runtime.RunString(string(result))
|
|
||||||
|
JSON := b.runtime.Get("JSON").ToObject(b.runtime)
|
||||||
|
parse, callable := goja.AssertFunction(JSON.Get("parse"))
|
||||||
|
if !callable {
|
||||||
|
panic("JSON.parse isn't a function")
|
||||||
|
}
|
||||||
|
|
||||||
|
resultVal, err := parse(goja.Null(), b.runtime.ToValue(string(result)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
setError(resp, -32603, err.Error())
|
setError(resp, -32603, err.Error())
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue