ruby-style-guide
ruby-style-guide copied to clipboard
Use StandardError over Exception
Based on discussion: https://github.com/rubocop-hq/rubocop/pull/7325/files#r320964544
Rubocop issue: https://github.com/rubocop-hq/rubocop/issues/7299
@marcandre Could you take a look? Cop w merged some time ago.
This PR still needs work...
It's true one should not raise an Exception, but it is not true one should raise a StandardException; it's more an abstract base class than anything else.
One should raise the appropriate exception (e.g. TypeError) or if nothing fits, a RuntimeError (which shouldn't be specified).
Maybe it would be best to modify the "don't rescue Exception" section, as they are related... Don't raise one because you should not rescue those...
Ping @denys281