From 007154ef2885647e29e71eb6bef060219cb03c30 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 28 Mar 2025 15:49:34 +1100 Subject: [PATCH] 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. --- config/initializers/deprecations.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 config/initializers/deprecations.rb diff --git a/config/initializers/deprecations.rb b/config/initializers/deprecations.rb new file mode 100644 index 0000000000..76d05f9acd --- /dev/null +++ b/config/initializers/deprecations.rb @@ -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