We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9655753 commit 5808d35Copy full SHA for 5808d35
test/test_except.py
@@ -8,13 +8,30 @@
8
@time: 16-4-13 下午6:38
9
"""
10
11
+import time
12
+import traceback
13
14
try:
15
# raise Exception('error_message')
16
raise Exception('error_message', 'error_code')
17
except Exception as e:
18
+ # 打印异常
19
+ print type(e), e
20
+
21
+ time.sleep(0.1)
22
23
+ # 打印异常消息
24
print type(e.message), e.message
- print type(e.args[0]), e.args[0]
25
26
27
28
+ # 打印异常参数
29
+ print e.args, type(e.args[0]), e.args[0]
30
31
32
33
+ # 打印异常堆栈跟踪信息 stack traceback
34
+ traceback.print_exc()
35
36
37
if __name__ == '__main__':
0 commit comments