Make checkout js error handling a bit more defensive

This commit is contained in:
Luis Ramos
2020-06-12 20:30:46 +01:00
parent a91c81059f
commit ed262a19a9

View File

@@ -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)