mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-13 23:37:47 +00:00
Log error when something goes wrong
Plus spec. The old implementation would swallow the error, all we had was a flash message feedback
This commit is contained in:
@@ -59,6 +59,7 @@ module Spree
|
||||
flash[:error] = t(:cannot_perform_operation)
|
||||
end
|
||||
rescue StandardError => e
|
||||
logger.error e.message
|
||||
flash[:error] = e.message
|
||||
ensure
|
||||
redirect_to request.referer
|
||||
|
||||
@@ -107,7 +107,7 @@ describe Spree::Admin::PaymentsController, type: :request do
|
||||
allow(payment).to receive(:void_transaction!).and_raise(StandardError, "Unexpected !")
|
||||
end
|
||||
|
||||
pending "log the error message" do
|
||||
it "log the error message" 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
|
||||
|
||||
Reference in New Issue
Block a user