Sha256: 66ec2fd19c9887b824fe586605673b0918b753fe4df211f24739fe1f5ef4301b

Contents?: true

Size: 1.09 KB

Versions: 10

Compression:

Stored size: 1.09 KB

Contents

module Chatterbox

  module RailsCatcher
    
    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
    
    # Overrides the rescue_action method in ActionController::Base, but does not inhibit
    # any custom processing that is defined with Rails 2's exception helpers.
    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
    
  end
  
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
relevance-chatterbox-0.1.0 lib/chatterbox/rails_catcher.rb
relevance-chatterbox-0.2.0 lib/chatterbox/rails_catcher.rb
relevance-chatterbox-0.2.1 lib/chatterbox/rails_catcher.rb
relevance-chatterbox-0.2.2 lib/chatterbox/rails_catcher.rb
relevance-chatterbox-0.3.0 lib/chatterbox/rails_catcher.rb
relevance-chatterbox-0.3.1 lib/chatterbox/rails_catcher.rb
relevance-chatterbox-0.3.2 lib/chatterbox/rails_catcher.rb
relevance-chatterbox-0.3.3 lib/chatterbox/rails_catcher.rb
chatterbox-0.4.0 lib/chatterbox/rails_catcher.rb
chatterbox-0.3.3 lib/chatterbox/rails_catcher.rb