Sha256: d4cb01b8ae6544caedd4d361cd5682ac26b60e84de72ca3e5a5fbed6f2319de5
Contents?: true
Size: 623 Bytes
Versions: 5
Compression:
Stored size: 623 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop module Lint # This cop checks for *rescue* blocks targeting the Exception class. class RescueException < Cop MSG = 'Avoid rescuing the Exception class.' def on_resbody(node) return unless node.children.first rescue_args = node.children.first.children if rescue_args.any? { |a| targets_exception?(a) } warning(node, :expression) end end def targets_exception?(rescue_arg_node) Util.const_name(rescue_arg_node) == 'Exception' end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems