class Rack::RailsErrorappNotifier

Public Class Methods

new(app) click to toggle source
# File lib/errorapp_notifier/notifiers/rack_rails.rb, line 5
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/errorapp_notifier/notifiers/rack_rails.rb, line 9
def call(env)
  begin
    body = @app.call(env)
  rescue Exception => e
    ::ErrorappNotifier::Notify.notify_with_controller(
      e,
      env['action_controller.instance'],
      Rack::Request.new(env)
    )
    raise
  end

  if env['rack.exception']
    ::ErrorappNotifier::Notify.notify_with_controller(
      env['rack.exception'],
      env['action_controller.instance'],
      Rack::Request.new(env)
    )
  end

  body
end