diff options
author | VG <vg@devys.org> | 2016-06-10 17:44:11 +0200 |
---|---|---|
committer | VG <vg@devys.org> | 2016-06-10 17:44:11 +0200 |
commit | 6e62cf116d561dcb8c7b72c9c5165db97706fec8 (patch) | |
tree | d7a466bbd80e9b6d569adf45d4ff7381a8749163 | |
parent | 6e7f287497e0dc9aec33c5cda1428cea2637ba79 (diff) | |
download | climl-6e62cf116d561dcb8c7b72c9c5165db97706fec8.tar.gz climl-6e62cf116d561dcb8c7b72c9c5165db97706fec8.tar.bz2 climl-6e62cf116d561dcb8c7b72c9c5165db97706fec8.zip |
display better messages when catching interface exceptions
-rw-r--r-- | climl/__init__.py | 6 | ||||
-rw-r--r-- | 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 |