Skip to content

Files

Latest commit

 

History

History
38 lines (29 loc) · 598 Bytes

Lint-ShadowedException.md

File metadata and controls

38 lines (29 loc) · 598 Bytes

Pattern: Shadowed rescued exception

Issue: -

Description

This rule checks for a rescued exception that get shadowed by a less specific exception being rescued before a more specific exception is rescued.

Examples

# bad

begin
  something
rescue Exception
  handle_exception
rescue StandardError
  handle_standard_error
end
# good

begin
  something
rescue StandardError
  handle_standard_error
rescue Exception
  handle_exception
end

Further Reading