[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r21071: {projects} Only log exception details if we actually have some (projects/gettor)



Author: kaner
Date: 2009-11-30 17:02:28 -0500 (Mon, 30 Nov 2009)
New Revision: 21071

Modified:
   projects/gettor/GetTor.py
Log:
Only log exception details if we actually have some


Modified: projects/gettor/GetTor.py
===================================================================
--- projects/gettor/GetTor.py	2009-11-30 21:22:17 UTC (rev 21070)
+++ projects/gettor/GetTor.py	2009-11-30 22:02:28 UTC (rev 21071)
@@ -25,8 +25,9 @@
 
 def processFail(conf, rawMessage, sendTo, e):
     """This routine gets called when something went wrong with the processing"""
-    log.error("Here is the exception I saw: %s" % sys.exc_info()[0])
-    log.error("Detail: %s" %e)
+    if e is not None:
+        log.error("Here is the exception I saw: %s" % sys.exc_info()[0])
+        log.error("Detail: %s" %e)
     # Keep a copy of the failed email for later reference
     log.info("We'll keep a record of this mail.")
     gettor.utils.dumpMessage(conf, rawMessage)
@@ -67,7 +68,7 @@
                                             sig, cmdAddr)
         if not reply.sendReply():
             log.error("Sending reply failed.")
-            processFail(conf, rawMessage, replyTo)
+            processFail(conf, rawMessage, replyTo, None)
             return False
         return True
     except Exception, e: