jsonrpc: wrap result unmarshal errors
This commit is contained in:
parent
6e24543e57
commit
e32d7aee12
@ -10,6 +10,7 @@ import (
|
|||||||
|
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
logging "github.com/ipfs/go-log"
|
logging "github.com/ipfs/go-log"
|
||||||
|
"golang.org/x/xerrors"
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = logging.Logger("rpc")
|
var log = logging.Logger("rpc")
|
||||||
@ -183,7 +184,7 @@ func NewClient(addr string, namespace string, handler interface{}) (ClientCloser
|
|||||||
if resp.Result != nil {
|
if resp.Result != nil {
|
||||||
log.Debugw("rpc result", "type", ftyp.Out(valOut))
|
log.Debugw("rpc result", "type", ftyp.Out(valOut))
|
||||||
if err := json.Unmarshal(resp.Result, rval.Interface()); err != nil {
|
if err := json.Unmarshal(resp.Result, rval.Interface()); err != nil {
|
||||||
return processError(err)
|
return processError(xerrors.Errorf("unmarshaling result: ", err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user