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:
Maikel Linke
2025-03-28 15:49:34 +11:00
parent db513470e0
commit 007154ef28

View 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