Closed sebbertho closed 3 months ago
Good suggestion, I have created PR #374 to fix this issue. In this PR, I changed the error handling to always throw a MollieApiException
and attempt to parse the error. If the parsing fails because the response is not in the expected format, the MollieApiException.Details
property contains the raw response and HTTP code.
Hi @sebbertho ,
This change is now live in version 4.1.0.0 of the NuGet package. Let me know if you have any feedback.
Kind regards, Vincent
Currently, only the following status codes are mapped to a MollieApiException:
HttpStatusCode.BadRequest HttpStatusCode.Unauthorized HttpStatusCode.Forbidden HttpStatusCode.NotFound HttpStatusCode.MethodNotAllowed HttpStatusCode.UnsupportedMediaType HttpStatusCode.Gone (HttpStatusCode) 422: Unprocessable Entity
The documentation mentions two additional status codes:
409 | Conflict – You are making a duplicate API call that was probably a mistake (only in v2). 429 | Too Many Requests – Your request has hit a rate limit. You can try again after a short period. Especially status code 409 is important to handle in an application, so it would be beneficial to have these mapped as well.