Bug 2055 fixed: raising JujuControllerFailedConnecting with error message
[osm/N2VC.git] / n2vc / libjuju.py
index 6bc9be7..7b01d5d 100644 (file)
@@ -121,7 +121,10 @@ class Libjuju:
             )
             if controller:
                 await self.disconnect_controller(controller)
-            raise JujuControllerFailedConnecting(e)
+
+            raise JujuControllerFailedConnecting(
+                f"Error connecting to Juju controller: {e}"
+            )
 
     async def disconnect(self):
         """Disconnect"""
@@ -1179,6 +1182,10 @@ class Libjuju:
                 controller,
                 timeout=total_timeout,
             )
+        except Exception as e:
+            if not await self.model_exists(model_name, controller=controller):
+                return
+            raise e
         finally:
             if model:
                 await self.disconnect_model(model)