aboutsummaryrefslogtreecommitdiff
path: root/rtr-origin/rtr-origin.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2012-03-15 23:25:32 +0000
committerRob Austein <sra@hactrn.net>2012-03-15 23:25:32 +0000
commitfdad10bc45997480ed54abdb828644f44d899550 (patch)
tree5a226711bdd8f0db4f602ee0f576c5d705a8b194 /rtr-origin/rtr-origin.py
parent66025dd6240f3d1ed55eb9aac9c9c2b5ba829ca4 (diff)
Tweak exception handling code to log exception class. See #212.
svn path=/trunk/; revision=4400
Diffstat (limited to 'rtr-origin/rtr-origin.py')
-rwxr-xr-xrtr-origin/rtr-origin.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/rtr-origin/rtr-origin.py b/rtr-origin/rtr-origin.py
index 3b6ec145..9064e77a 100755
--- a/rtr-origin/rtr-origin.py
+++ b/rtr-origin/rtr-origin.py
@@ -1060,11 +1060,12 @@ class pdu_channel(asynchat.async_chat):
"""
Handle errors caught by asyncore main loop.
"""
- if backtrace_on_exceptions:
+ c, e = sys.exc_info()[:2]
+ if backtrace_on_exceptions or e == 0:
for line in traceback.format_exc().splitlines():
log(line)
else:
- log("[Exception: %s]" % sys.exc_info()[1])
+ log("[Exception: %s: %s]" % (c.__name__, e)
log("[Exiting after unhandled exception]")
sys.exit(1)
@@ -1356,11 +1357,12 @@ class kickme_channel(asyncore.dispatcher):
"""
Handle errors caught by asyncore main loop.
"""
- if backtrace_on_exceptions:
+ c, e = sys.exc_info()[:2]
+ if backtrace_on_exceptions or e == 0:
for line in traceback.format_exc().splitlines():
log(line)
else:
- log("[Exception: %s]" % sys.exc_info()[1])
+ log("[Exception: %s: %s]" % (c.__name__, e)
log("[Exiting after unhandled exception]")
sys.exit(1)