mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-04 07:09:14 +00:00
Make checkout controller send bugsnag alerts on every checkout problem
There are two new situations here: we will see order.errors after update_attributes fails but before order restart; and we will see how often the order is not complete when the workflow finishes (maybe none)
This commit is contained in:
@@ -53,9 +53,8 @@ class CheckoutController < Spree::StoreController
|
||||
rescue Spree::Core::GatewayError => e
|
||||
rescue_from_spree_gateway_error(e)
|
||||
rescue StandardError => e
|
||||
Bugsnag.notify(e)
|
||||
flash[:error] = I18n.t("checkout.failed")
|
||||
update_failed
|
||||
update_failed(e)
|
||||
end
|
||||
|
||||
# Clears the cached order. Required for #current_order to return a new order
|
||||
@@ -179,6 +178,7 @@ class CheckoutController < Spree::StoreController
|
||||
@order.select_shipping_method(shipping_method_id) if @order.state == "delivery"
|
||||
|
||||
next if advance_order_state(@order)
|
||||
|
||||
return update_failed
|
||||
end
|
||||
|
||||
@@ -216,7 +216,7 @@ class CheckoutController < Spree::StoreController
|
||||
checkout_succeeded
|
||||
update_succeeded_response
|
||||
else
|
||||
update_failed
|
||||
update_failed(RuntimeError.new("Order not complete after the checkout workflow"))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -242,7 +242,9 @@ class CheckoutController < Spree::StoreController
|
||||
end
|
||||
end
|
||||
|
||||
def update_failed
|
||||
def update_failed(error = RuntimeError.new(order_error))
|
||||
Bugsnag.notify(error)
|
||||
|
||||
flash[:error] = order_error if flash.empty?
|
||||
checkout_failed
|
||||
update_failed_response
|
||||
|
||||
Reference in New Issue
Block a user