Description of the Bug
When doing a request which results in a 4xx status code without a body, an error with the following description is returned:
Sorry, something went wrong when trying to process the request. If this problem persists, contact us at support@chargebee.com. type: internal_error, http_status_code: 500, error_code: internal_error, content:
This incorrectly states that the status code was 500. This seems to be caused by this code:
|
return fmt.Errorf("Sorry, something went wrong when trying to process the request. If this problem persists, contact us at support@chargebee.com. \n type: internal_error, \n http_status_code: 500, \n error_code: internal_error,\n content: %q", bodyStr) |
, where an error occurs when trying to Unmarshal the empty body content to an Error struct which makes it fall back to this default error.
I experienced this for the EntitlementsForCustomer request.
Steps to reproduce
- Make a
EntitlementsForCustomer request with an invalid customer ID (for example a url as that contains characters that are not allowed): res, err := customerentitlement.EntitlementsForCustomer(invalidCustomerID, params).ListRequest()
- Check the error in the
err variable
Expected Behavior
I would expect an error which correctly states the status code
Code Snippets (if applicable)
Operating System
macOS
Language version
1.25.0
Library version
v3.38.1
Additional context
No response
Description of the Bug
When doing a request which results in a 4xx status code without a body, an error with the following description is returned:
Sorry, something went wrong when trying to process the request. If this problem persists, contact us at support@chargebee.com. type: internal_error, http_status_code: 500, error_code: internal_error, content:This incorrectly states that the status code was 500. This seems to be caused by this code:
chargebee-go/http_request.go
Line 169 in 264e918
I experienced this for the
EntitlementsForCustomerrequest.Steps to reproduce
EntitlementsForCustomerrequest with an invalid customer ID (for example a url as that contains characters that are not allowed):res, err := customerentitlement.EntitlementsForCustomer(invalidCustomerID, params).ListRequest()errvariableExpected Behavior
I would expect an error which correctly states the status code
Code Snippets (if applicable)
Operating System
macOS
Language version
1.25.0
Library version
v3.38.1
Additional context
No response