Skip to content

Commit

Permalink
Rubocop fixed: Lint/HandleExceptions
Browse files Browse the repository at this point in the history
Added a debug message to an otherwise rescue clause.
  • Loading branch information
mvidner committed Aug 4, 2015
1 parent abc29e7 commit c27d9cd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/ruby/yast/builtins.rb
Expand Up @@ -124,8 +124,9 @@ def self.maplist(object, &block)
object.each do |i|
res << block.call(Yast.deep_copy(i))
end
rescue Yast::Break # rubocop:disable Lint/HandleExceptions
rescue Yast::Break
# break skips out of each loop, but allow to keep previous results
Yast.y2debug(1, "break in maplist(Array)")
end
return res
when ::Hash
Expand All @@ -134,8 +135,9 @@ def self.maplist(object, &block)
sort(object.keys).each do |k|
res << block.call(Yast.deep_copy(k), Yast.deep_copy(object[k]))
end
rescue Yast::Break # rubocop:disable Lint/HandleExceptions
rescue Yast::Break
# break skips out of each loop, but allow to keep previous results
Yast.y2debug(1, "break in maplist(Hash)")
end
return res
else
Expand Down Expand Up @@ -385,8 +387,9 @@ def self.listmap(list, &block)
Yast.deep_copy(list).each do |i|
res.merge! block.call(i)
end
rescue Yast::Break # rubocop:disable Lint/HandleExceptions
rescue Yast::Break
# break stops adding to hash
Yast.y2debug(1, "break in listmap")
end

res
Expand Down Expand Up @@ -514,8 +517,9 @@ def self.mapmap(map, &block)
sort(map.keys).each do |k|
res.merge! block.call(k, map[k])
end
rescue Yast::Break # rubocop:disable Lint/HandleExceptions
rescue Yast::Break
# break stops adding to hash
Yast.y2debug(1, "break in mapmap")
end

res
Expand Down

0 comments on commit c27d9cd

Please sign in to comment.