Open Blacksmoke16 opened 2 months ago
I recently learned in a rescue block, you do not have to provide a variable name if you do not need access to the exception instance. E.g.
rescue
begin raise MyException.new("OH NO!") rescue MyException puts "Rescued MyException" end # Output: Rescued MyException
works just fine.
Similar to how ameba will flag unused local/block variables, I'm wondering if it should also flag cases like:
begin raise MyException.new("OH NO!") rescue ex : MyException puts "Rescued MyException" end
where the ex variable is unused, and suggest changing it to rescue MyException.
ex
rescue MyException
I recently learned in a
rescue
block, you do not have to provide a variable name if you do not need access to the exception instance. E.g.works just fine.
Similar to how ameba will flag unused local/block variables, I'm wondering if it should also flag cases like:
where the
ex
variable is unused, and suggest changing it torescue MyException
.