2014-03-29 22:48:21 +00:00
|
|
|
# Reraise not the latest occured exception
|
|
|
|
def f():
|
|
|
|
try:
|
|
|
|
raise ValueError("val", 3)
|
|
|
|
except:
|
|
|
|
try:
|
2014-03-30 00:39:15 +00:00
|
|
|
print(1)
|
2014-03-29 22:48:21 +00:00
|
|
|
raise TypeError
|
|
|
|
except:
|
2014-03-30 00:39:15 +00:00
|
|
|
print(2)
|
2014-03-29 22:48:21 +00:00
|
|
|
try:
|
2014-03-30 00:39:15 +00:00
|
|
|
print(3)
|
2014-03-29 22:48:21 +00:00
|
|
|
try:
|
2014-03-30 00:39:15 +00:00
|
|
|
print(4)
|
2014-03-29 22:48:21 +00:00
|
|
|
raise AttributeError
|
|
|
|
except:
|
2014-03-30 00:39:15 +00:00
|
|
|
print(5)
|
2014-03-29 22:48:21 +00:00
|
|
|
pass
|
2014-03-30 00:39:15 +00:00
|
|
|
print(6)
|
2014-03-29 22:48:21 +00:00
|
|
|
raise
|
|
|
|
except TypeError:
|
2014-03-30 00:39:15 +00:00
|
|
|
print(7)
|
2014-03-29 22:48:21 +00:00
|
|
|
pass
|
2014-03-30 00:39:15 +00:00
|
|
|
print(8)
|
|
|
|
print(9)
|
2014-03-29 22:48:21 +00:00
|
|
|
# This should raise original ValueError, not the most recently occurred AttributeError
|
|
|
|
raise
|
|
|
|
|
|
|
|
try:
|
|
|
|
f()
|
|
|
|
except ValueError as e:
|
|
|
|
print(repr(e))
|