Make RPCError an actual error and don't swallow its companion data

This commit is contained in:
Silas Davis
2017-10-22 15:14:21 +01:00
parent d4634dc683
commit 3e3d53daef
4 changed files with 27 additions and 3 deletions

View File

@ -147,7 +147,7 @@ func unmarshalResponseBytes(responseBytes []byte, result interface{}) (interface
return nil, errors.Errorf("Error unmarshalling rpc response: %v", err)
}
if response.Error != nil {
return nil, errors.Errorf("Response error: %v", response.Error.Message)
return nil, errors.Errorf("Response error: %v", response.Error)
}
// unmarshal the RawMessage into the result
err = json.Unmarshal(*response.Result, result)

View File

@ -437,7 +437,7 @@ func (c *WSClient) readRoutine() {
continue
}
if response.Error != nil {
c.ErrorsCh <- errors.New(response.Error.Message)
c.ErrorsCh <- response.Error
continue
}
c.Logger.Info("got response", "resp", response.Result)