Class: NdrError::Recorder
- Inherits:
-
Object
- Object
- NdrError::Recorder
- Defined in:
- lib/ndr_error/recorder.rb
Overview
Middleware for logging exceptions, can be used as exception_app for Rails.
Direct Known Subclasses
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(parent_handler) ⇒ Recorder
constructor
the parent_handler could be the host app’s routes, or an instance of ActionDispatch::PublicExceptions, or any other middleware.
Constructor Details
#initialize(parent_handler) ⇒ Recorder
the parent_handler could be the host app’s routes, or an instance of ActionDispatch::PublicExceptions, or any other middleware.
6 7 8 |
# File 'lib/ndr_error/recorder.rb', line 6 def initialize(parent_handler) @parent_handler = parent_handler end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ndr_error/recorder.rb', line 10 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 @parent_handler.call(env) end |