class API_Exception extends Exception

This api exception returns more information than the default one. The aim it let the api consumer know better what is exactly the error without having to parse the error message.

If you consume an api that doesn't return an error_code or the extra data you need, consider improving the api and contribute.

Constants

UNAUTHORIZED

NOT_IMPLEMENTED

Methods

__construct(string $message, mixed $error_code, array $extraParams = array(), $previous = NULL)

Class constructor.

string
__toString()

Custom string representation of object.

array
getExtraParams()

Get extra parameters.

array
getErrorCodes()

Get error codes.

Details

at line 40
__construct(string $message, mixed $error_code, array $extraParams = array(), $previous = NULL)

Class constructor.

Parameters

string $message The human friendly error message.
mixed $error_code A computer friendly error code. By convention, no space (but underscore allowed) (ex: mandatory_missing, duplicate, invalid_format).
array $extraParams Extra params to return. eg an extra array of ids. It is not mandatory, but can help the computer using the api. Keep in mind the api consumer isn't to be trusted. eg. the database password is NOT a good extra data.
$previous A previous exception which caused this new exception.

at line 57
string __toString()

Custom string representation of object.

Return Value

string

at line 66
array getExtraParams()

Get extra parameters.

Return Value

array

at line 75
array getErrorCodes()

Get error codes.

Return Value

array