[PCBC-58] Couchbase.so - constructing Couchbase() doesn't throw an exception on connection error Created: 23/Mar/12  Updated: 11/Feb/13  Resolved: 07/Nov/12

Status: Resolved
Project: Couchbase PHP client library
Component/s: library
Affects Version/s: 1.0
Fix Version/s: None
Security Level: Public

Type: Improvement Priority: Major
Reporter: Michael Steuer Assignee: Mark Nunberg
Resolution: Won't Fix Votes: 1
Labels: ext/couchbase
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by PCBC-134 Provide more information on connectio... Resolved
is duplicated by PCBC-70 Throw Exceptions on connect Resolved

 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...


 Comments   
Comment by Matt Ingenthron [ 07/Nov/12 ]
Mark: Please determine if this issue is still valid and help me triage it into the appropriate release. I've assigned it to you for triage, not necessarily to fix it.
Comment by Mark Nunberg [ 07/Nov/12 ]
Connection error handling has been extensively dealt with and resolved in later issues..

In summary, while no exception is thrown, it is possible to check if the connection succeeded or not.
Generated at Tue Jul 29 10:39:20 CDT 2014 using JIRA 5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9.