File: errbase.rb

package info (click to toggle)
ruby-errbase 0.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 84 kB
  • sloc: ruby: 39; makefile: 3
file content (49 lines) | stat: -rw-r--r-- 1,382 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require "errbase/version"

module Errbase
  class << self
    def report(e, info = {})
      Airbrake.notify(e, info) if defined?(Airbrake)

      if defined?(Appsignal)
        if Appsignal::VERSION.to_i >= 3
          Appsignal.send_error(e) do |transaction|
            transaction.set_tags(info)
          end
        else
          Appsignal.send_error(e, info)
        end
      end

      if defined?(Bugsnag)
        Bugsnag.notify(e) do |report|
          report.add_tab(:info, info) if info.any?
        end
      end

      ExceptionNotifier.notify_exception(e, data: info) if defined?(ExceptionNotifier)

      # TODO add info
      Google::Cloud::ErrorReporting.report(e) if defined?(Google::Cloud::ErrorReporting)

      Honeybadger.notify(e, context: info) if defined?(Honeybadger)

      NewRelic::Agent.notice_error(e, custom_params: info) if defined?(NewRelic::Agent)

      Raven.capture_exception(e, extra: info) if defined?(Raven)

      Raygun.track_exception(e, custom_data: info) if defined?(Raygun)

      Rollbar.error(e, info) if defined?(Rollbar)

      if defined?(ScoutApm::Error)
        ScoutApm::Context.add(info)
        ScoutApm::Error.capture(e)
      end

      Sentry.capture_exception(e, extra: info) if defined?(Sentry)
    rescue => e
      $stderr.puts "[errbase] Error reporting exception: #{e.class.name}: #{e.message}"
    end
  end
end