Bare except catching failure
jayvdb opened this issue · comments
John Vandenberg commented
The follow (bad) Python will catch the exception
try:
raise Exception("foo")
except:
print("Got it")
It is transpiled as
begin
raise Exception, "foo"
rescue
print("Got it")
end
That only catches the default Ruby exception StandardError
.
To catch the exception in Ruby, it needs to catch the top level Ruby exception class.
begin
raise Exception, "foo"
rescue Exception
print("Got it")
end