Module: CrashLog::Rails::Middleware::DebugExceptionCatcher

Defined in:
lib/crash_log/rails/middleware/debug_exception_catcher.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
# File 'lib/crash_log/rails/middleware/debug_exception_catcher.rb', line 6

def self.included(base)
  base.send(:alias_method_chain, :render_exception, :crash_log)
end

Instance Method Details

#render_exception_with_crash_log(env, exception) ⇒ Object

Hook into the rails error rendering page to send this exception to CrashLog before rails handlers take over.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/crash_log/rails/middleware/debug_exception_catcher.rb', line 12

def render_exception_with_crash_log(env, exception)
  begin
    controller = env['action_controller.instance']
    CrashLog.notify_or_ignore(exception, crash_log_context(controller, env))

    if defined?(controller.rescue_action_in_public_without_crash_log)
      controller.rescue_action_in_public_without_crash_log(exception)
    end

  rescue Exception => e
    # If it breaks here there is possibly something wrong with us, so
    # instead of crashing again, we'll just pass it on.
  end
  render_exception_without_crash_log(env, exception)
end