$errors
$errors : array
Stores the list of errors.
Error API: Error Class
Based on WordPress error API. Container for checking for TriTan CMS errors and error messages. Return Error and use \TriTan\is_ttcms_error() to check if this class is returned. Many core TriTan CMS functions pass this class in the event of an error and if not handled properly will result in code errors.
__construct(string|integer $code = '', string $message = '', mixed $data = '')
Initialize the error.
If $code
is empty, the other parameters will be ignored.
When $code
is not empty, $message
will be used even if
it is empty. The $data
parameter will be used only if it
is not empty.
Though the class is constructed with a single error code and
message, multiple codes can be added using the add()
method.
string|integer | $code | Error code |
string | $message | Error message |
mixed | $data | Optional. Error data. |
getErrorMessages(string|integer $code = '') : array
Retrieve all error messages or error messages matching code.
string|integer | $code | Optional. Retrieve messages matching code, if exists. |
Error strings on success, or empty array on failure (if using code parameter).
getErrorMessage(string|integer $code = '') : string
Get single error message.
This will get the first message available for the code. If no code is given then the first code available will be used.
string|integer | $code | Optional. Error code to retrieve message. |