Sha256: 8cdeaea1c5b239128f01460edf2321be6a74f81685ca7420dabd9b8df30a590d

Contents?: true

Size: 784 Bytes

Versions: 1

Compression:

Stored size: 784 Bytes

Contents

class Flail
  module Rails
    module RescueAction
      # Sets up an alias chain to catch exceptions when Rails does
      def self.included(base)
        base.send(:alias_method, :rescue_action_in_public_without_flail, :rescue_action_in_public)
        base.send(:alias_method, :rescue_action_in_public, :rescue_action_in_public_with_flail)
      end

      private

      # Overrides the rescue_action method in ActionController::Base
      # but uses any custom processing that is defined with
      # Rails 2's exception helpers.
      def rescue_action_in_public_with_flail(exception)
        request.env['flail.request'] = request
        Flail::Exception.new(request.env, exception).handle!
        rescue_action_in_public_without_flail(exception)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flail-0.0.2 lib/flail/rails/rescue_action.rb