diff --git a/client/error.go b/client/error.go index ec9ad8e..01eb38c 100644 --- a/client/error.go +++ b/client/error.go @@ -16,5 +16,8 @@ type Error struct { } func (e *Error) Error() string { + if nil == e.Err { + return "" + } return e.Err.Error() } diff --git a/client/request-state.go b/client/request-state.go index fe4b034..2e89d8c 100644 --- a/client/request-state.go +++ b/client/request-state.go @@ -39,6 +39,9 @@ func (rs *requestState) isCanceled() bool { } func (rs *requestState) setError(err error) { + if nil == err { + return + } rs.clientError = newError(rs.method, rs.params, err) } diff --git a/protocol/json/client_response.go b/protocol/json/client_response.go index 2d419ea..611c917 100644 --- a/protocol/json/client_response.go +++ b/protocol/json/client_response.go @@ -29,7 +29,7 @@ func (crc *ClientResponseCodec) ID() interface{} { func (crc *ClientResponseCodec) Result(result interface{}) error { if nil == crc.res.Error && nil != crc.res.Result { - if err := json.Unmarshal(*crc.res.Result, result); nil != err { + if err := json.Unmarshal(*crc.res.Result, &result); nil != err { return err } return nil