Class: NdrError::Middleware::PublicExceptions

Inherits:
ActionDispatch::PublicExceptions
  • Object
show all
Defined in:
lib/ndr_error/middleware/public_exceptions.rb

Overview

Middleware for logging exceptions, can be used as exception_app for Rails.

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/ndr_error/middleware/public_exceptions.rb', line 5

def call(env)
  rescuing_everything do
    request   = ActionDispatch::Request.new(env)
    exception = env['action_dispatch.exception']

    # "falsey" callback return value allows logging to be skipped
    log_exception(request, exception) if run_exception_callback(request, exception)
  end

  super # Invoke the PublicExceptions behaviour
end