diff options
author | Thomas Bruederli <bruederli@kolabsys.com> | 2014-03-05 06:42:11 -0500 |
---|---|---|
committer | Thomas Bruederli <bruederli@kolabsys.com> | 2014-03-05 06:42:11 -0500 |
commit | cfe5378af4eb9bbe6c210f85263c23842f6ca490 (patch) | |
tree | 68a730a90da9009309f0327d531dc439deea5918 | |
parent | 7bd1d324254b08e1366f734cf168422d08b297c7 (diff) | |
download | pykolab-cfe5378af4eb9bbe6c210f85263c23842f6ca490.tar.gz |
Catch and log unexpected exceptions from wallace modules; abort loop if a module 'consumed' a message
-rw-r--r-- | wallace/__init__.py | 10 |
1 files changed, 9 insertions, 1 deletions
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) |