Sha256: 09cceb304cbe882d974dc300dbfc13ef5a7d17b13be47a427c55f1c1f06e77ce

Contents?: true

Size: 866 Bytes

Versions: 22

Compression:

Stored size: 866 Bytes

Contents

module Rollbar
  module ExceptionReporter
    include RequestDataExtractor

    def report_exception_to_rollbar(env, exception)
      rollbar_debug "[Rollbar] Reporting exception: #{exception.try(:message)}", :error
      request_data = extract_request_data_from_rack(env)
      person_data = extract_person_data_from_controller(env)
      exception_data = Rollbar.report_exception(exception, request_data, person_data)
      env['rollbar.exception_uuid'] = exception_data[:uuid]
      rollbar_debug "[Rollbar] Exception uuid saved in env: #{exception_data[:uuid]}"
    rescue => e
      rollbar_debug "[Rollbar] Exception while reporting exception to Rollbar: #{e.try(:message)}"
    end

    def rollbar_debug(message, level = :debug)
      if defined?(Rails)
        ::Rails.logger.send(level, message)
      else
        puts message
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rollbar-0.8.1 lib/rollbar/exception_reporter.rb
rollbar-0.8.0 lib/rollbar/exception_reporter.rb