File: bugsnag.rb

package info (click to toggle)
ruby-uniform-notifier 1.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 240 kB
  • sloc: ruby: 915; makefile: 4
file content (30 lines) | stat: -rw-r--r-- 713 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

class UniformNotifier
  class BugsnagNotifier < Base
    class << self
      def active?
        !!UniformNotifier.bugsnag
      end

      protected

      def _out_of_channel_notify(data)
        exception = Exception.new(data[:title])
        exception.set_backtrace(data[:backtrace]) if data[:backtrace]

        return nil if data.empty?

        Bugsnag.notify(exception) do |report|
          report.severity = "warning"
          report.add_tab(:bullet, data)
          report.grouping_hash = data[:body] || data[:title]

          if UniformNotifier.bugsnag.is_a?(Proc)
            UniformNotifier.bugsnag.call(report)
          end
        end
      end
    end
  end
end