wallace/__init__.py

Thomas Brüderli bruederli at kolabsys.com
Mon Mar 10 12:26:03 CET 2014


 wallace/__init__.py |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit cfe5378af4eb9bbe6c210f85263c23842f6ca490
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Mar 5 06:42:11 2014 -0500

    Catch and log unexpected exceptions from wallace modules; abort loop if a module 'consumed' a message

diff --git a/wallace/__init__.py b/wallace/__init__.py
index 6b1b96c..aeb1ccc 100644
--- a/wallace/__init__.py
+++ b/wallace/__init__.py
@@ -24,6 +24,7 @@ import grp
 import multiprocessing
 import os
 import pwd
+import traceback
 from smtpd import SMTPChannel
 import socket
 import struct
@@ -62,9 +63,16 @@ def pickup_message(filepath, *args, **kw):
             modules.execute(kw['module'], filepath)
 
     for module in wallace_modules:
-        result_filepath = modules.execute(module, filepath)
+        try:
+            result_filepath = modules.execute(module, filepath)
+        except:
+            log.error(_("Module %s.execute() failed on message %r with error: %s" % (module, filepath, traceback.format_exc())))
+            result_filepath = False
+
         if not result_filepath == None and not result_filepath == False:
             filepath = result_filepath
+        else:
+            break
 
 def worker_process(*args, **kw):
     log.debug(_("Worker process %s initializing") % (multiprocessing.current_process().name), level=1)




More information about the commits mailing list