actions: Handle exceptions thrown by create_handler.
authorMatthijs Kooijman <matthijs@stdin.nl>
Thu, 10 Jun 2010 06:28:38 +0000 (08:28 +0200)
committerMatthijs Kooijman <matthijs@stdin.nl>
Thu, 10 Jun 2010 06:28:38 +0000 (08:28 +0200)
src/lib/backupninja/action.py

index bb54d0a..1ebc737 100644 (file)
@@ -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)