Details
Description
When you connect via the new Couchbase(...) is not a direct way to check for whether the connection failed.
It is not possible to check getResultCode()/getResultMessage() since this provides a unintilized couchbase
It is not possible to check getResultCode()/getResultMessage() since this provides a unintilized couchbase
Issue Links
- duplicates
-
PCBC-58
Couchbase.so - constructing Couchbase() doesn't throw an exception on connection error
-
For the non-oo variant (couchbase_connect) behavior should remain the same (?)
Additionally, all the code which now checks for the couchbase object to simply exist should be changed to check that the couchbase object is indeed connected (I believe lcb has a function for that, but if not we can set our own little flag in our php_couchbase_ctx structure).
One workaround is to call set_error_handler and make it throw an ErrorException right before instantiation. Then the connection can be done in a try/catch block, with any message being found in $ex->getMessage().
I believe there may be ther workarounds as well