Sha256: 1dc89c4b3a57eccb8e8841ad662260351498c04a43da816eea1f807a0e4d3a0e

Contents?: true

Size: 1.16 KB

Versions: 25

Compression:

Stored size: 1.16 KB

Contents

module HoptoadNotifier
  module Rails
    module ActionControllerCatcher

      # Sets up an alias chain to catch exceptions when Rails does
      def self.included(base) #:nodoc:
        base.send(:alias_method, :rescue_action_in_public_without_hoptoad, :rescue_action_in_public)
        base.send(:alias_method, :rescue_action_in_public, :rescue_action_in_public_with_hoptoad)
      end

      private

      # 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_hoptoad(exception)
        unless hoptoad_ignore_user_agent?
          HoptoadNotifier.notify_or_ignore(exception, hoptoad_request_data)
        end
        rescue_action_in_public_without_hoptoad(exception)
      end

      def hoptoad_ignore_user_agent? #:nodoc:
        # Rails 1.2.6 doesn't have request.user_agent, so check for it here
        user_agent = request.respond_to?(:user_agent) ? request.user_agent : request.env["HTTP_USER_AGENT"]
        HoptoadNotifier.configuration.ignore_user_agent.flatten.any? { |ua| ua === user_agent }
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 5 rubygems

Version Path
hoptoad_notifier-2.4.2 lib/hoptoad_notifier/rails/action_controller_catcher.rb
hoptoad_notifier-2.4.1 lib/hoptoad_notifier/rails/action_controller_catcher.rb
hoptoad_notifier-2.4.0 lib/hoptoad_notifier/rails/action_controller_catcher.rb
hoptoad_notifier-2.3.12 lib/hoptoad_notifier/rails/action_controller_catcher.rb
hoptoad_notifier-2.3.11 lib/hoptoad_notifier/rails/action_controller_catcher.rb
hoptoad_notifier-2.3.10 lib/hoptoad_notifier/rails/action_controller_catcher.rb
hoptoad_notifier-2.3.9 lib/hoptoad_notifier/rails/action_controller_catcher.rb
hoptoad_notifier-2.3.8 lib/hoptoad_notifier/rails/action_controller_catcher.rb
hoptoad_notifier-2.3.7 lib/hoptoad_notifier/rails/action_controller_catcher.rb
riscfuture-hoptoad_notifier-2.3.6 lib/hoptoad_notifier/rails/action_controller_catcher.rb
hoptoad_notifier-2.3.6 lib/hoptoad_notifier/rails/action_controller_catcher.rb
hoptoad_notifier-2.3.5 lib/hoptoad_notifier/rails/action_controller_catcher.rb
hoptoad_notifier-2.3.4 lib/hoptoad_notifier/rails/action_controller_catcher.rb
hoptoad_notifier-2.3.3 lib/hoptoad_notifier/rails/action_controller_catcher.rb
hoptoad_notifier-2.3.2 lib/hoptoad_notifier/rails/action_controller_catcher.rb
jordan-brough-hoptoad_notifier-2.3.0 lib/hoptoad_notifier/rails/action_controller_catcher.rb
hoptoad_notifier-2.3.0 lib/hoptoad_notifier/rails/action_controller_catcher.rb
hatless-hoptoad_notifier-2.2.6.1 lib/hoptoad_notifier/rails/action_controller_catcher.rb
hatless-hoptoad_notifier-2.2.6.001 lib/hoptoad_notifier/rails/action_controller_catcher.rb
hatless-hoptoad_notifier-2.2.6 lib/hoptoad_notifier/rails/action_controller_catcher.rb