Sha256: 4a28eb3633ba17309355dfdda813fcc6f1bb5730f34e4eed41c6e921d6727d76

Contents?: true

Size: 958 Bytes

Versions: 8

Compression:

Stored size: 958 Bytes

Contents

module Rollbar
  module ExceptionReporter
    def report_exception_to_rollbar(env, exception)
      exception_message = exception.respond_to?(:message) ? exception.message : 'No Exception Message'
      Rollbar.log_debug "[Rollbar] Reporting exception: #{exception_message}"

      exception_data = Rollbar.log(Rollbar.configuration.uncaught_exception_level, exception)

      if exception_data.is_a?(Hash)
        env['rollbar.exception_uuid'] = exception_data[:uuid]
        Rollbar.log_debug "[Rollbar] Exception uuid saved in env: #{exception_data[:uuid]}"
      elsif exception_data == 'disabled'
        Rollbar.log_debug "[Rollbar] Exception not reported because Rollbar is disabled"
      elsif exception_data == 'ignored'
        Rollbar.log_debug "[Rollbar] Exception not reported because it was ignored"
      end
    rescue => e
      Rollbar.log_warning "[Rollbar] Exception while reporting exception to Rollbar: #{e.message}"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rollbar-1.3.2 lib/rollbar/exception_reporter.rb
rollbar-1.3.1 lib/rollbar/exception_reporter.rb
rollbar-1.3.0 lib/rollbar/exception_reporter.rb
rollbar-1.2.13 lib/rollbar/exception_reporter.rb
rollbar-1.2.12 lib/rollbar/exception_reporter.rb
rollbar-1.2.11 lib/rollbar/exception_reporter.rb
rollbar-1.2.10 lib/rollbar/exception_reporter.rb
rollbar-1.2.9 lib/rollbar/exception_reporter.rb