# File lib/action_controller/rescue.rb, line 90 def rescue_from(*klasses, &block) options = klasses.extract_options! unless options.has_key?(:with) block_given? ? options[:with] = block : raise(ArgumentError, "Need a handler. Supply an options hash that has a :with key as the last argument.") end klasses.each do |klass| key = if klass.is_a?(Class) && klass <= Exception klass.name elsif klass.is_a?(String) klass else raise(ArgumentError, "#{klass} is neither an Exception nor a String") end # Order is important, we put the pair at the end. When dealing with an # exception we will follow the documented order going from right to left. rescue_handlers << [key, options[:with]] end end