class RuboCop::Cop::Lint::ShadowedException

def sorted?(rescued_groups)

def sorted?(rescued_groups)
  rescued_groups.each_cons(2).all? do |x, y|
    if x.include?(Exception)
      false
    elsif y.include?(Exception) ||
          # consider sorted if a group is empty or only contains
          # `nil`s
          x.none? || y.none?
      true
    else
      (x <=> y || 0) <= 0
    end
  end
end