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:
To use the error in the code:
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 | ( | ) |
getMessage | ( | ) |
setData | ( | $data | ) |
Set the error data.
- Parameters
-
$data Some error codes require to transmit further information to the client
Definition at line 89 of file ApplicationError.php.
getData | ( | ) |
__toString | ( | ) |
Get a string representation of the error.
- Returns
- String
Definition at line 105 of file ApplicationError.php.
|
static |
Factory method for retrieving a predefind error instance.
- Parameters
-
$code An error code $data Some error codes required to transmit further information to the client (optional, default: null)
- Returns
- ApplicationError
Definition at line 120 of file ApplicationError.php.
|
static |
Factory method for creating a general error instance.
- Parameters
-
$message Error message
- Returns
- ApplicationError
Definition at line 135 of file ApplicationError.php.
|
static |
Factory method for transforming an exception into an ApplicationError instance.
- Parameters
-
$ex Exception
- Returns
- ApplicationError
Definition at line 144 of file ApplicationError.php.