You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Single-line rescue expressions swallow all exceptions, returning the argument to the rescue.
It's a relatively common mistake to put an exception as the argument, mistakingly assuming that it will rescue from that exception alone, rather than all exceptions.
classSpecificError < ExceptionendclassOtherError < Exceptionenddefraises_other_errorraiseOtherError.new
end
result = raises_other_error rescueSpecificErrorputs result # => SpecificError
I propose that ameba produces a warning when the argument to a single-line rescue is an exception.
The text was updated successfully, but these errors were encountered:
Single-line
rescue
expressions swallow all exceptions, returning the argument to therescue
.It's a relatively common mistake to put an exception as the argument, mistakingly assuming that it will rescue from that exception alone, rather than all exceptions.
See the example below.
I propose that ameba produces a warning when the argument to a single-line
rescue
is an exception.The text was updated successfully, but these errors were encountered: