Files
openfoodnetwork/config/initializers/deprecations.rb
Maikel Linke 007154ef28 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.
2025-03-28 17:01:26 +11:00

15 lines
398 B
Ruby

# 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