You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
283 B
19 lines
283 B
# Reraising last exception with raise w/o args
|
|
|
|
def f():
|
|
try:
|
|
raise ValueError("val", 3)
|
|
except:
|
|
raise
|
|
|
|
try:
|
|
f()
|
|
except ValueError as e:
|
|
print(repr(e))
|
|
|
|
|
|
# Can reraise only in except block
|
|
try:
|
|
raise
|
|
except RuntimeError:
|
|
print("RuntimeError")
|
|
|