Give its constructor an argument, store that as an attribute, then retrieve it in the except
clause:
class FooException(Exception):
def __init__(self, foo):
self.foo = foo
try:
raise FooException("Foo!")
except FooException as e:
print e.foo
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…