From b28c821a628aa44d082d167c4527d7776af5699e Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Thu, 10 Jun 2010 08:18:29 +0200 Subject: [PATCH] actions: Catch and log exceptions when running handlers. --- src/lib/backupninja/action.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lib/backupninja/action.py b/src/lib/backupninja/action.py index 3f57a18..95c43fd 100644 --- a/src/lib/backupninja/action.py +++ b/src/lib/backupninja/action.py @@ -21,6 +21,8 @@ """ Running backup actions """ +import logging as log + from backupninja import config from backupninja import handlers @@ -53,9 +55,12 @@ def run_action(action, opts, global_config): # Create a handler for this action handler = handlers.create_handler(action_ty, action_config) - if handler: - # Run the handler - handler.run() - handler.finish() # Silently skip invalid handlers, create_handler will have # logged an error + if handler: + try: + # Run the handler + handler.run() + handler.finish() + except Exception, e: + log.error('Running action "%s" failed: %s', action, e) -- 2.30.2