jsonrpc: wrap result unmarshal errors

This commit is contained in:
Łukasz Magiera 2019-07-18 12:46:32 +02:00
parent 6e24543e57
commit e32d7aee12

View File

@ -10,6 +10,7 @@ import (
"github.com/gorilla/websocket"
logging "github.com/ipfs/go-log"
"golang.org/x/xerrors"
)
var log = logging.Logger("rpc")
@ -183,7 +184,7 @@ func NewClient(addr string, namespace string, handler interface{}) (ClientCloser
if resp.Result != nil {
log.Debugw("rpc result", "type", ftyp.Out(valOut))
if err := json.Unmarshal(resp.Result, rval.Interface()); err != nil {
return processError(err)
return processError(xerrors.Errorf("unmarshaling result: ", err))
}
}
}