For this we'd probably need to change the ext code to return a valid couchbase object so that getResultCode can be called on it (to check for connection failures).
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