mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-17 00:07:24 +00:00
Replace obsolete ErrorLogger
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'open_food_network/error_logger'
|
||||
require "spree/core/controller_helpers/auth"
|
||||
require "spree/core/controller_helpers/common"
|
||||
require "spree/core/controller_helpers/order"
|
||||
@@ -37,7 +36,7 @@ class UserRegistrationsController < Devise::RegistrationsController
|
||||
end
|
||||
end
|
||||
rescue StandardError => e
|
||||
OpenFoodNetwork::ErrorLogger.notify(e)
|
||||
Alert.raise(e)
|
||||
render_error(message: I18n.t('unknown_error', scope: I18N_SCOPE))
|
||||
end
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Our error logging API currently wraps Bugsnag.
|
||||
# It makes us more flexible if we wanted to replace Bugsnag or change logging
|
||||
# behaviour.
|
||||
module OpenFoodNetwork
|
||||
module ErrorLogger
|
||||
# Tries to escalate the error to a developer.
|
||||
# If Bugsnag is configured, it will notify it. It would be nice to implement
|
||||
# some kind of fallback.
|
||||
def self.notify(error)
|
||||
Alert.raise(error)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -27,7 +27,7 @@ RSpec.describe UserRegistrationsController, type: :controller do
|
||||
|
||||
it "returns error when emailing fails" do
|
||||
allow(Spree::UserMailer).to receive(:confirmation_instructions).and_raise("Some error")
|
||||
expect(OpenFoodNetwork::ErrorLogger).to receive(:notify)
|
||||
expect(Alert).to receive(:raise)
|
||||
|
||||
post :create, xhr: true, params: { spree_user: user_params, use_route: :spree }
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
require 'open_food_network/error_logger'
|
||||
|
||||
module OpenFoodNetwork
|
||||
RSpec.describe ErrorLogger do
|
||||
let(:error) { StandardError.new("Test") }
|
||||
|
||||
it "notifies Bugsnag" do
|
||||
expect(Bugsnag).to receive(:notify).with(error)
|
||||
|
||||
ErrorLogger.notify(error)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user