\apiException

Custom exception

Terminates the script and displays error, if wasn't catched

Summary

Methods
Properties
Constants
__construct()
getO()
getAPICode()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$o
$APIcode
N/A

Properties

$o

$o : array

Type

array — Additional options

$APIcode

$APIcode : integer

Type

integer — Recieved error code

Methods

__construct()

__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

Parameters

integer $code

API Error code

array $o

Additional fields for error

Examples

The Exception could be throwed by statements
        // Check for results
        if (!$ur->rowCount() > 0) { // No results
            throw new apiException(105); // Access Denied
        }
Catching an exception to do other tasks
        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;
        }

getO()

getO() : array

Error Extended

Get API Error Extended details, if they were provided. Used for internal purposes.

Returns

array —

Extended details

getAPICode()

getAPICode() : integer

Error Code

Get Error code, which was provided by Exception thrower. Used for internal purposes.

Returns

integer —

The API Error code