Skip to content

Commit

Permalink
return error with response body data
Browse files Browse the repository at this point in the history
  • Loading branch information
chenzhijie committed Aug 15, 2022
1 parent 08979c4 commit bb8a40f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rpc/transport/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ func (h *HTTP) Call(method string, out interface{}, params ...interface{}) error

var response codec.Response
if err := json.Unmarshal(res.Body(), &response); err != nil {
return err
return fmt.Errorf("json unmarshal response body %s err %s", res.Body(), err)
}
if response.Error != nil {
return response.Error
}

if err := json.Unmarshal(response.Result, out); err != nil {
return err
return fmt.Errorf("json unmarshal response result %s err %s", res.Body(), err)
}
return nil
}
Expand Down

0 comments on commit bb8a40f

Please sign in to comment.