class RubbyCop::Cop::Lint::HandleExceptions

This cop checks for rescue blocks with no body.

@example

# bad

def some_method
  do_something
rescue
  # do nothing
end

@example

# bad

begin
  do_something
rescue
  # do nothing
end

@example

# good

def some_method
  do_something
rescue
  handle_exception
end

@example

# good

begin
  do_something
rescue
  handle_exception
end

Constants

MSG

Public Instance Methods

on_resbody(node) click to toggle source
# File lib/rubbycop/cop/lint/handle_exceptions.rb, line 50
def on_resbody(node)
  add_offense(node, :expression) unless node.body
end