Skip to content

Files

Latest commit

 

History

History
29 lines (20 loc) · 631 Bytes

Lint-ConstantOverwrittenInRescue.md

File metadata and controls

29 lines (20 loc) · 631 Bytes

Pattern: Constant overwritten in rescue

Issue: -

Description

Checks for overwriting an exception with an exception result by using rescue ⇒.

You intended to write as rescue StandardError. However, you have written rescue ⇒ StandardError. In that case, the result of rescue will overwrite StandardError.

Examples

# bad
begin
  something
rescue => StandardError
end

# good
begin
  something
rescue StandardError
end

Further Reading