From 6e62cf116d561dcb8c7b72c9c5165db97706fec8 Mon Sep 17 00:00:00 2001 From: VG Date: Fri, 10 Jun 2016 17:44:11 +0200 Subject: display better messages when catching interface exceptions --- climl/__init__.py | 6 +++--- climl/imap.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/climl/__init__.py b/climl/__init__.py index 8924ebf..b4ccecf 100644 --- a/climl/__init__.py +++ b/climl/__init__.py @@ -18,10 +18,10 @@ def on_email(content, hooks, conf): print('on_email, calling hook {}'.format(hook.__name__)) hook(context) print('on_email, end of hook {}'.format(hook.__name__)) - except interface.HookStopIteration: - pass + except interface.HookStopIteration as e: + print('hook wanted to stop processing for current email', e) print('now, raising exception (for dev purpose only)') - raise interface.HookAbortError() + raise interface.HookAbortError('dev purpose abort') def conf_boolean_postprocess(src): diff --git a/climl/imap.py b/climl/imap.py index 7743712..5c66833 100644 --- a/climl/imap.py +++ b/climl/imap.py @@ -125,8 +125,9 @@ def process_emails(connection, callback=None, maxsize=None): callback(data) print('mark mail {}'.format(oneid)) connection.add_flags([oneid], ['\Answered']) - except interface.HookAbortError: + except interface.HookAbortError as e: print('callback wanted to skip marking of mail {}'.format(oneid)) + print('reason', e) data = None -- cgit v1.2.3