From 5687af1dbbe8647ac6f333e0480d44e31d1fa6f3 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Thu, 10 Jun 2010 08:28:38 +0200 Subject: [PATCH] actions: Handle exceptions thrown by create_handler. --- src/lib/backupninja/action.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/lib/backupninja/action.py b/src/lib/backupninja/action.py index bb54d0a..1ebc737 100644 --- a/src/lib/backupninja/action.py +++ b/src/lib/backupninja/action.py @@ -53,15 +53,12 @@ def run_action(action, opts, global_config): # Get the config for this action action_config = config.get_action_config(opts, action) - # Create a handler for this action - handler = handlers.create_handler(action_ty, action_config) - # 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) + try: + # Create a handler for this action + handler = handlers.create_handler(action_ty, action_config) + # Run it + handler.run() + handler.finish() + except Exception, e: + log.error('Running action "%s" failed: %s', action, e) -- 2.30.2