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
The follow (bad) Python will catch the exception
It is transpiled as
That only catches the default Ruby exception
StandardError.To catch the exception in Ruby, it needs to catch the top level Ruby exception class.