Handle stripe amount_too_large errors

This commit is contained in:
ravi-signal
2024-12-18 18:46:22 -06:00
committed by GitHub
parent 68f27be7cd
commit 77658415b2
4 changed files with 56 additions and 15 deletions

View File

@@ -22,10 +22,10 @@ public class SubscriptionExceptionMapper implements ExceptionMapper<Subscription
public Response toResponse(final SubscriptionException exception) {
// Some exceptions have specific error body formats
if (exception instanceof SubscriptionException.AmountTooSmall e) {
if (exception instanceof SubscriptionException.InvalidAmount e) {
return Response
.status(Response.Status.BAD_REQUEST)
.entity(Map.of("error", "amount_too_small"))
.entity(Map.of("error", e.getErrorCode()))
.type(MediaType.APPLICATION_JSON_TYPE)
.build();
}