module InfluxReporter::Integration::Rails::InjectExceptionsCatcher

Public Class Methods

included(cls) click to toggle source
# File lib/influx_reporter/integration/rails/inject_exceptions_catcher.rb, line 7
def self.included(cls)
  cls.send(:alias_method, :render_exception_without_influx_reporter, :render_exception)
  cls.send(:alias_method, :render_exception, :render_exception_with_influx_reporter)
end

Public Instance Methods

render_exception_with_influx_reporter(env, exception) click to toggle source
# File lib/influx_reporter/integration/rails/inject_exceptions_catcher.rb, line 12
def render_exception_with_influx_reporter(env, exception)
  begin
    InfluxReporter.report(exception, tags: { rack_env: env }) if InfluxReporter.started?
  rescue
    ::Rails.logger.error "** [InfluxReporter] Error capturing or sending exception #{$ERROR_INFO}"
    ::Rails.logger.debug $ERROR_INFO.backtrace.join("\n")
  end

  render_exception_without_influx_reporter(env, exception)
end