Pattern: Use of return
in ensure
block
Issue: -
If you explicitly return from a method inside an ensure
block, the return will take precedence over any exception being raised, and the method will return as if no exception had been raised at all. In effect, the exception will be silently thrown away.
# bad
begin
do_something
ensure
do_something_else
return
end
# good
begin
do_something
ensure
do_something_else
end