mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Notify Bugsnag on deprecations in staging & production
The behaviour was set to `notify` already but we were missing a notification handler. Now we'll get alerted about deprecations which were not covered by specs.
This commit is contained in:
14
config/initializers/deprecations.rb
Normal file
14
config/initializers/deprecations.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ActiveSupport::Notifications.subscribe(/deprecation/) do |_name, _start, _finish, _id, payload|
|
||||
e = ActiveSupport::DeprecationException.new(payload[:message])
|
||||
e.set_backtrace(payload[:callstack].map(&:to_s))
|
||||
|
||||
Bugsnag.notify(e) do |report|
|
||||
report.severity = "warning"
|
||||
report.add_tab(
|
||||
:deprecation,
|
||||
payload.except(:callstack),
|
||||
)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user