From cca8a27ef91c1c8c02b67b7ba3621f2c283101d8 Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Thu, 5 Sep 2013 11:38:39 +0800 Subject: [PATCH] handle exceptions in callbacks --- archrepo2/repomon.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/archrepo2/repomon.py b/archrepo2/repomon.py index c9a3078..2390d08 100755 --- a/archrepo2/repomon.py +++ b/archrepo2/repomon.py @@ -194,7 +194,10 @@ class RepoMan: del actiondict[act.name] else: # take the later action, but record the former - actiondict[act.name].callback(state=0) + try: + actiondict[act.name].callback(state=0) + except: + logger.exception('failed to run action %r.', actiondict[act.name]) actiondict[act.name] = act toadd = [(x.path, x.callback) for x in actiondict.values() if x.action == 'add'] toremove = [(x.name, x.callback) for x in actiondict.values() if x.action == 'remove']