Details
-
Type:
Improvement
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 1.0
-
Fix Version/s: None
-
Component/s: library
-
Security Level: Public
-
Labels:
Description
When constructing Couchbase() and it fails to connect, no exception is thrown, which results in that condition being impossible to be caught... It would be really helpful if the constructor could throw an exception...
Steps to reproduce:
1. shut down Couchbase server or provide invalid host
2. wrap couchbase constructor in try..catch block, e.g.
try {
$cb = new Couchbase($host, $couchbase['username'], $couchbase['password'], $couchbase['bucket']);
} catch(Exception $e) {
// couldn't connect to couchbase
error_log("cb error");
}
3. notice how no exception is caught when couchbase fails to connect...
Steps to reproduce:
1. shut down Couchbase server or provide invalid host
2. wrap couchbase constructor in try..catch block, e.g.
try {
$cb = new Couchbase($host, $couchbase['username'], $couchbase['password'], $couchbase['bucket']);
} catch(Exception $e) {
// couldn't connect to couchbase
error_log("cb error");
}
3. notice how no exception is caught when couchbase fails to connect...
In summary, while no exception is thrown, it is possible to check if the connection succeeded or not.