From: Matthijs Kooijman Date: Thu, 10 Jun 2010 06:28:38 +0000 (+0200) Subject: actions: Handle exceptions thrown by create_handler. X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fprojects%2Fbackupninja.git;a=commitdiff_plain;h=5687af1dbbe8647ac6f333e0480d44e31d1fa6f3;ds=sidebyside actions: Handle exceptions thrown by create_handler. --- 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)