lib/active_support/rescuable.rb in activesupport-5.0.0.beta3 vs lib/active_support/rescuable.rb in activesupport-5.0.0.beta4

- old
+ new

@@ -113,7 +113,17 @@ else Proc.new { |_exception| instance_exec(_exception, &rescuer) } end end end + + def index_of_handler_for_rescue(exception) + handlers = self.class.rescue_handlers.reverse_each.with_index + _, index = handlers.detect do |(klass_name, _), _| + klass = self.class.const_get(klass_name) rescue nil + klass ||= (klass_name.constantize rescue nil) + klass === exception if klass + end + index + end end end