Module: Chatterbox::RailsCatcher

Defined in:
lib/chatterbox/rails_catcher.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
# File 'lib/chatterbox/rails_catcher.rb', line 5

def self.included(base)
  if base.instance_methods.map(&:to_s).include? 'rescue_action_in_public' and !base.instance_methods.map(&:to_s).include? 'rescue_action_in_public_without_chatterbox'
    base.send(:alias_method, :rescue_action_in_public_without_chatterbox, :rescue_action_in_public)
    base.send(:alias_method, :rescue_action_in_public, :rescue_action_in_public_with_chatterbox)
  end
end

Instance Method Details

#rescue_action_in_public_with_chatterbox(exception) ⇒ Object

Overrides the rescue_action method in ActionController::Base, but does not inhibit any custom processing that is defined with Rails 2’s exception helpers.



14
15
16
17
18
19
20
# File 'lib/chatterbox/rails_catcher.rb', line 14

def rescue_action_in_public_with_chatterbox exception
  Chatterbox.logger.debug { "#{self.class}#rescue_action_in_public_with_chatterbox: caught exception #{exception} - about to handle"}
  Chatterbox.handle_notice(exception)
  Chatterbox.logger.debug { "#{self.class}#rescue_action_in_public_with_chatterbox: handing exception #{exception} off to normal rescue handling"}
  
  rescue_action_in_public_without_chatterbox(exception)
end