Sha256: 0bb9129d9b239eed4461a1282105b462a7a561b1a367b74f61fce195e1688808

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

module Safely
  DEFAULT_EXCEPTION_METHOD = proc do |e, info|
    begin
      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)
        # no way to add context for a single call
        # ScoutApm::Context.add(info)
        ScoutApm::Error.capture(e)
      end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
safely_block-0.4.0 lib/safely/services.rb