Notify BugSnag when something unexpected happens

This commit is contained in:
Gaetan Craig-Riou
2024-02-28 15:08:57 +11:00
parent b5beeead74
commit 48ba23af1c
2 changed files with 2 additions and 0 deletions

View File

@@ -60,6 +60,7 @@ module Spree
end
rescue StandardError => e
logger.error e.message
Bugsnag.notify(e)
flash[:error] = e.message
ensure
redirect_to request.referer

View File

@@ -111,6 +111,7 @@ describe Spree::Admin::PaymentsController, type: :request do
# The redirect_do also calls Rails.logger.error
expect(Rails.logger).to receive(:error).with("Unexpected !").ordered
expect(Rails.logger).to receive(:error).with(/Redirected/).ordered
expect(Bugsnag).to receive(:notify).with(StandardError)
put(
"/admin/orders/#{order.number}/payments/#{order.payments.first.id}/fire?e=void",