This repository has been archived by the owner on May 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Error Handling
Mira Dytko edited this page Jan 20, 2022
·
3 revisions
Use the Aerospike PHP client to manage errors.
The Aerospike PHP client passes the status code that returns from the underlying C client. All non-zero status codes (!== Aerospike::OK
) are errors.
Status codes are constants of the Aerospike class.
$status = $db->get($key, $record);
if ($status == Aerospike::OK) {
var_dump($record);
} elseif ($status == Aerospike::ERR_RECORD_NOT_FOUND) {
echo "A record with this key does not exist in the database\n";
}
Use these calls to determine the operation status of the most-recent client operation:
error()
errorno()
$db = new Aerospike($config);
if (!$db->isConnected()) {
echo "Failed to connect[{$db->errorno()}]: {$db->error()}\n";
exit(1);
}
PHP Client