@@ -388,61 +388,3 @@ func (c *Client) do(req *http.Request, log logger.Logger, method, endpoint strin
388388
389389 return resp , nil
390390}
391-
392- // handleErrorResponse processes and logs errors from an HTTP response, allowing for a customizable error message.
393- //
394- // Parameters:
395- // - resp: The *http.Response received from the server.
396- // - log: An instance of a logger (conforming to the logger.Logger interface) for logging the error details.
397- // - errorMessage: A custom error message that provides context about the error.
398- // - method: The HTTP method used for the request, for logging purposes.
399- // - endpoint: The endpoint the request was sent to, for logging purposes.
400- //
401- // Returns:
402- // - An error object parsed from the HTTP response, indicating the nature of the failure.
403- // func (c *Client) handleErrorResponse(resp *http.Response, out interface{}, log logger.Logger, method, endpoint string) error {
404- // if err := c.APIHandler.HandleAPIErrorResponse(resp, out, log); err != nil {
405- // log.Error("Failed to unmarshal HTTP response",
406- // zap.String("method", method),
407- // zap.String("endpoint", endpoint),
408- // zap.Error(err),
409- // )
410- // return err
411- // }
412- // log.Info("HTTP request succeeded",
413- // zap.String("method", method),
414- // zap.String("endpoint", endpoint),
415- // zap.Int("status_code", resp.StatusCode),
416- // )
417- // return nil
418- // }
419-
420- // handleSuccessResponse unmarshals a successful HTTP response into the provided output parameter and logs the
421- // success details. It's designed for use when the response indicates success (status code within 200-299).
422- // The function logs the request's success and, in case of unmarshalling errors, logs the failure and returns the error.
423- //
424- // Parameters:
425- // - resp: The *http.Response received from the server.
426- // - out: A pointer to the variable where the unmarshalled response will be stored.
427- // - log: An instance of a logger (conforming to the logger.Logger interface) for logging success or unmarshalling errors.
428- // - method: The HTTP method used for the request, for logging purposes.
429- // - endpoint: The endpoint the request was sent to, for logging purposes.
430- //
431- // Returns:
432- // - nil if the response was successfully unmarshalled into the 'out' parameter, or an error if unmarshalling failed.
433- // func (c *Client) handleSuccessResponse(resp *http.Response, out interface{}, log logger.Logger, method, endpoint string) error {
434- // if err := c.APIHandler.HandleAPISuccessResponse(resp, out, log); err != nil {
435- // log.Error("Failed to unmarshal HTTP response",
436- // zap.String("method", method),
437- // zap.String("endpoint", endpoint),
438- // zap.Error(err),
439- // )
440- // return err
441- // }
442- // log.Info("HTTP request succeeded",
443- // zap.String("method", method),
444- // zap.String("endpoint", endpoint),
445- // zap.Int("status_code", resp.StatusCode),
446- // )
447- // return nil
448- // }
0 commit comments