Error handling with the Couchbase PHP interface is currently
handled using a combination of return values, exceptions and error
codes. Return values are used for operations such as
get(), which returns the corresponding
document value if successful, or false if the
document could not be found.
An explicit error code system is available when you want to identify specific errors, but the methods to obtain these must be called immediately after each operation to identify a specific failure. These methods are deprecated in place of the PHP exception mechanism and may be removed in a future release.
All the interface calls support exceptions and will raise a
specific or generic Couchbase exception if an operation fails. For
more information on the exceptions supported, see
Section 3.1.1, “Exceptions”. Operations
also raise a result code which can be obtained by calling the
getResultCode() method immediately after
an operation. Constants are provided to identify specific error
conditions. See Section 3.1.2, “Error Codes and Constants” for
more information.