class UnionStationHooksRails::ExceptionLogger

Public Class Methods

new(app) click to toggle source
# File lib/union_station_hooks_rails/exception_logger.rb, line 27
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/union_station_hooks_rails/exception_logger.rb, line 31
def call(env)
  @app.call(env)
rescue Exception => e
  report_exception(env, e)
  raise e
end

Private Instance Methods

report_exception(env, exception) click to toggle source
# File lib/union_station_hooks_rails/exception_logger.rb, line 39
def report_exception(env, exception)
  reporter = env['union_station_hooks']
  if reporter
    reporter.log_exception(exception)
  end
end