Skip to content

Commit

Permalink
log errors in StripeController.updateSource
Browse files Browse the repository at this point in the history
  • Loading branch information
brmeyer committed May 8, 2023
1 parent 20bc1be commit 8e31205
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -334,7 +333,7 @@ public Response updateSource(
@FormParam(value = "successUrl") String successUrl,
@FormParam(value = "failUrl") String failUrl,
@Context HttpServletRequest request
) throws UnsupportedEncodingException {
) {
Environment env = envFactory.init(request);
StripeClient stripeClient = env.stripeClient();

Expand Down Expand Up @@ -372,6 +371,7 @@ public Response updateSource(
}
return Response.temporaryRedirect(URI.create(successUrl)).build();
} catch (StripeException e) {
log.info("failed to update the source for {}", customerEmail, e);
String error = URLEncoder.encode(e.getMessage(), StandardCharsets.UTF_8);
return Response.temporaryRedirect(URI.create(failUrl + "?error=" + error)).build();
}
Expand Down

0 comments on commit 8e31205

Please sign in to comment.