Detailed Description

ApplicationError is used to signal errors that occur while processing a request.

This class only allows to use predefined errors by using the ApplicationError::get() method. Errors are defined in the following way:

define('GENERAL_WARNING', serialize(array('GENERAL_WARNING',
$message->getText('An unspecified warning occured.'), ERROR_LEVEL_WARNING)));

To use the error in the code:

$error = ApplicationError::get('GENERAL_WARNING', $mySpecificErrorData);
Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 46 of file ApplicationError.php.

Public Member Functions

 getCode ()
 
 getMessage ()
 
 setData ($data)
 
 getData ()
 
 __toString ()
 

Static Public Member Functions

static get ($code, $data=null)
 
static getGeneral ($message)
 
static fromException (\Exception $ex)
 

Member Function Documentation

getCode ( )

Get the error code.

Returns
The code

Definition at line 72 of file ApplicationError.php.

getMessage ( )

Get the error message.

Returns
The message

Definition at line 80 of file ApplicationError.php.

setData (   $data)

Set the error data.

Parameters
$dataSome error codes require to transmit further information to the client

Definition at line 89 of file ApplicationError.php.

getData ( )

Get the error data.

Returns
The data

Definition at line 97 of file ApplicationError.php.

__toString ( )

Get a string representation of the error.

Returns
String

Definition at line 105 of file ApplicationError.php.

static get (   $code,
  $data = null 
)
static

Factory method for retrieving a predefind error instance.

Parameters
$codeAn error code
$dataSome error codes required to transmit further information to the client (optional, default: null)
Returns
ApplicationError

Definition at line 120 of file ApplicationError.php.

static getGeneral (   $message)
static

Factory method for creating a general error instance.

Parameters
$messageError message
Returns
ApplicationError

Definition at line 135 of file ApplicationError.php.

static fromException ( \Exception  $ex)
static

Factory method for transforming an exception into an ApplicationError instance.

Parameters
$exException
Returns
ApplicationError

Definition at line 144 of file ApplicationError.php.