mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Add error handling for MongoDB connection failure in Client class
This commit is contained in:
1 parent
ff66361916
commit
fba2c96b6e
1 file changed
+5
-2
+5
-2
@@ -118,8 +118,11 @@ class Client
|
||||
if ($this->client->isConnected()) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
if(!$this->client->connect($this->host, $this->port)){
|
||||
throw new \Exception("Failed to connect to MongoDB");
|
||||
}
|
||||
|
||||
$this->client->connect($this->host, $this->port);
|
||||
[$payload, $db] = $this->auth->start();
|
||||
|
||||
$res = $this->query($payload, $db);
|
||||
@@ -934,4 +937,4 @@ class Client
|
||||
$this->replicaSet = property_exists($result, 'setName');
|
||||
return $this->replicaSet;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user