$o
$o : array
Custom exception
Terminates the script and displays error, if wasn't catched
__construct(integer $code, array $o = array()) : void
Throw the Exception
Define APIError code and options to terminate the script and show an error message to user
It's used to stop execution and show an error to user if happens something critical. In some cases classes/methods/functions (such as class User) can throw this object. If you would like to prevent terminating and error displaying you can catch the exception
| integer | $code | API Error code |
| array | $o | Additional fields for error |
// Check for results
if (!$ur->rowCount() > 0) { // No results
throw new apiException(105); // Access Denied
}
try {
// Get user ............................... !! Only by LOGIN
$u = new User($v, ['GET_MODE' => 'login', 'U_GET' => true]);
$ra['response'][] = $u->get();
} catch (apiException $e) {
$ra['response'][] = false;
}