Sha256: f6bb1bbe99bf558ca78cedbf41c7eea482a5b7d0c7e2cce03138a54f92b4a58e

Contents?: true

Size: 907 Bytes

Versions: 4

Compression:

Stored size: 907 Bytes

Contents

module Rollbar
  module ExceptionReporter
    include RequestDataExtractor

    def report_exception_to_rollbar(env, exception)
      Rollbar.log_debug "[Rollbar] Reporting exception: #{exception.try(: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

4 entries across 4 versions & 1 rubygems

Version Path
rollbar-1.2.3 lib/rollbar/exception_reporter.rb
rollbar-1.2.2 lib/rollbar/exception_reporter.rb
rollbar-1.2.1 lib/rollbar/exception_reporter.rb
rollbar-1.2.0 lib/rollbar/exception_reporter.rb