@@ -171,7 +171,10 @@ func (this *Client) RequestWithRetry(method string, params string) (string, erro
171
171
}
172
172
173
173
func (this * Client ) Request (method string , params string ) (prim.Option [string ], error ) {
174
- responseBodyBytes , _ := this .RequestRaw (method , params )
174
+ responseBodyBytes , err := this .RequestRaw (method , params )
175
+ if err != nil {
176
+ return prim .None [string ](), err
177
+ }
175
178
176
179
var mappedData map [string ]interface {}
177
180
if err := json .Unmarshal (responseBodyBytes , & mappedData ); err != nil {
@@ -232,14 +235,17 @@ func (this *Client) RequestRaw(method string, params string) ([]byte, error) {
232
235
233
236
defer response .Body .Close ()
234
237
235
- responseBodyBytes , _ := io .ReadAll (response .Body )
238
+ responseBodyBytes , err := io .ReadAll (response .Body )
239
+ if err != nil {
240
+ return []byte {}, err
241
+ }
236
242
// fmt.Println("response Status:", response.Status)
237
243
// fmt.Println("response Headers:", response.Header)
238
244
// fmt.Println("response Body:", string(responseBodyBytes))
239
245
240
246
if response .StatusCode != http .StatusOK {
241
247
err := ErrorCode001
242
- err .Message = fmt .Sprintf (`Status Code : %v` , response .StatusCode )
248
+ err .Message = fmt .Sprintf (`Status: %v. Response Body : %v` , response .Status , string ( responseBodyBytes ) )
243
249
return []byte {}, & err
244
250
}
245
251
0 commit comments