Skip to content

Files

Latest commit

 

History

History
43 lines (29 loc) · 791 Bytes

Lint-InheritException.md

File metadata and controls

43 lines (29 loc) · 791 Bytes

Pattern: Inheritance from Exception

Issue: -

Description

This rule looks for error classes inheriting from Exception and its standard library subclasses, excluding subclasses of StandardError. It is configurable to suggest using either RuntimeError (default) or StandardError instead.

Examples

# bad

class C < Exception; end
# EnforcedStyle: runtime_error (default)

# good

class C < RuntimeError; end
# EnforcedStyle: standard_error

# good

class C < StandardError; end

Default configuration

Attribute Value
EnforcedStyle runtime_error
SupportedStyles runtime_error, standard_error

Further Reading