Skip to content

Commit

Permalink
Merge pull request #5598 from luisramos0/checkout_error
Browse files Browse the repository at this point in the history
Make checkout js error handling a bit more defensive
  • Loading branch information
sauloperez authored Jun 16, 2020
2 parents 3cfec15 + ed262a1 commit 6a31c56
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/assets/javascripts/darkswarm/services/checkout.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ Darkswarm.factory 'Checkout', ($injector, CurrentOrder, ShippingMethods, StripeE
throw error # generate a BugsnagJS alert

handle_checkout_error_response: (response) =>
if response.data.path
throw response unless response.data?

if response.data.path?
Navigation.go response.data.path
else
throw response unless response.data.flash
throw response unless response.data.flash?

@errors = response.data.errors
@loadFlash(response.data.flash)
Expand Down

0 comments on commit 6a31c56

Please sign in to comment.