lib/rollbar.rb
# Reports an exception to Rollbar. Returns the exception data hash.
#
# @example
#   begin
#     foo = bar
#   rescue => e
#     Rollbar.report_exception(e)
#   end
#
# @param exception [Exception] The exception object to report
# @param request_data [Hash] Data describing the request. Should be the result of calling
#   `rollbar_request_data`.
# @param person_data [Hash] Data describing the affected person. Should be the result of calling
#   `rollbar_person_data`
Reports an exception to Rollbar. Returns the exception data hash.
Reports an exception to Rollbar . Returns the exception data hash .
def report_exception(exception, request_data = nil, person_data = nil)
      return 'disabled' unless configuration.enabled
      return 'ignored' if ignored?(exception)
      data = exception_data(exception, filtered_level(exception))
      if request_data
        request_data[:env].reject!{|k, v| v.is_a?(IO) } if request_data[:env]
        data[:request] = request_data
      end
      data[:person] = person_data if person_data
      @last_report = data
      payload = build_payload(data)
      schedule_payload(payload)
      log_instance_link(data)
      data
    rescue => e
      report_internal_error(e)
      'error'
    end
def report_exception ( exception , request_data = nil , person_data = nil ) return 'disabled' unless configuration . enabled return 'ignored' if ignored? ( exception ) data = exception_data ( exception , filtered_level ( exception ) ) if request_data request_data [ :env ] . reject! { | k , v | v . is_a? ( IO ) } if request_data [ :env ] data [ :request ] = request_data end data [ :person ] = person_data if person_data @last_report = data payload = build_payload ( data ) schedule_payload ( payload ) log_instance_link ( data ) data rescue => e report_internal_error ( e ) 'error' end
Reports an exception to Rollbar.
Reports an exception to Rollbar .
exception
The exception object to report
The exception object to report
request_data
Data describing the request. Should be the result of calling `rollbar_request_data`.
Data describing the request . Should be the result of calling ` rollbar_request_data ` .
person_data
Data describing the affected person. Should be the result of calling `rollbar_person_data`
Data describing the affected person . Should be the result of calling ` rollbar_person_data `
example
begin foo = bar rescue => e Rollbar.report_exception(e) end
begin foo = bar rescue = > e Rollbar . report_exception ( e ) end