actions: Handle exceptions thrown by create_handler.
[matthijs/projects/backupninja.git] / src / lib / backupninja / action.py
index bb54d0a168f8b6985505ca658903b0c705a60baa..1ebc737cfdd76c7b0c176f175659128fd87e7a32 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)