Class: SmartException

Class for extended exception used in the SmartFactory library.

Extends

\Exception

Known inheritances

Authors

Oleg Schildt

Package

Source code

 

Constants
public

Constant for the error code "config_error".

public

Constant for the error code "file_write_error".

public

Constant for the error code "invalid_content_type".

public

Constant for the error code "invalid_request_data".

public

Constant for the error code "json_parse_error".

public

Constant for the error code "missing_request_data".

public

Constant for the error code "not_found".

public

Constant for the error code "path_access_error".

public

Constant for the error code "system_error".

public

Constant for the error code "xml_parse_error".

Properties
protected

Internal variable for storing the error.

protected

Internal variable for storing the error details.

protected

Internal variable for storing the error element.

protected

Internal variable for storing the additional technical information.

Methods
public

Constructor.

public

Returns the string error code of the exception.

public

Returns the error details of the exception.

public

Returns the error element.

public

Returns the technical information for the error.

public

Sets the error element.


Constant: SmartException::ERR_CODE_CONFIG_ERROR

const ERR_CODE_CONFIG_ERROR = "config_error";

Constant for the error code "config_error".

Type

string

Authors

Oleg Schildt

Source code


Constant: SmartException::ERR_CODE_FILE_WRITE_ERROR

const ERR_CODE_FILE_WRITE_ERROR = "file_write_error";

Constant for the error code "file_write_error".

Type

string

Authors

Oleg Schildt

Source code


Constant: SmartException::ERR_CODE_INVALID_CONTENT_TYPE

const ERR_CODE_INVALID_CONTENT_TYPE = "invalid_content_type";

Constant for the error code "invalid_content_type".

Type

string

Authors

Oleg Schildt

Source code


Constant: SmartException::ERR_CODE_INVALID_REQUEST_DATA

const ERR_CODE_INVALID_REQUEST_DATA = "invalid_request_data";

Constant for the error code "invalid_request_data".

Type

string

Authors

Oleg Schildt

Source code


Constant: SmartException::ERR_CODE_JSON_PARSE_ERROR

const ERR_CODE_JSON_PARSE_ERROR = "json_parse_error";

Constant for the error code "json_parse_error".

Type

string

Authors

Oleg Schildt

Source code


Constant: SmartException::ERR_CODE_MISSING_REQUEST_DATA

const ERR_CODE_MISSING_REQUEST_DATA = "missing_request_data";

Constant for the error code "missing_request_data".

Type

string

Authors

Oleg Schildt

Source code


Constant: SmartException::ERR_CODE_NOT_FOUND

const ERR_CODE_NOT_FOUND = "not_found";

Constant for the error code "not_found".

Type

string

Authors

Oleg Schildt

Source code


Constant: SmartException::ERR_CODE_PATH_ACCESS_ERROR

const ERR_CODE_PATH_ACCESS_ERROR = "path_access_error";

Constant for the error code "path_access_error".

Type

string

Authors

Oleg Schildt

Source code


Constant: SmartException::ERR_CODE_SYSTEM_ERROR

const ERR_CODE_SYSTEM_ERROR = "system_error";

Constant for the error code "system_error".

Type

string

Authors

Oleg Schildt

Source code


Constant: SmartException::ERR_CODE_XML_PARSE_ERROR

const ERR_CODE_XML_PARSE_ERROR = "xml_parse_error";

Constant for the error code "xml_parse_error".

Type

string

Authors

Oleg Schildt

Source code


Property: SmartException::$error_code

protected string $error_code = SmartException::ERR_CODE_SYSTEM_ERROR;

Internal variable for storing the error.

Type

string

Authors

Oleg Schildt

Source code

See also


Property: SmartException::$error_details

protected array $error_details = [];

Internal variable for storing the error details.

Details

The error details might be useful if the error message translations are provided on the client, not on the server, and the error message should contain some details that may vary from case to case. In that case, the servers return the error message id instead of final text and the details, the client uses the error message id, gets the final translated text and substitutes the parameters through the details.

Type

array

Authors

Oleg Schildt

Source code

See also


Property: SmartException::$error_element

protected string $error_element = "";

Internal variable for storing the error element.

Type

string

Authors

Oleg Schildt

Source code

See also


Property: SmartException::$technical_info

protected string $technical_info = "";

Internal variable for storing the additional technical information.

Type

string

Authors

Oleg Schildt

Source code

See also


Method: SmartException::__construct()

public function __construct(string $message, string $error_code = SmartException::ERR_CODE_SYSTEM_ERROR, string $error_element = "", array $error_details = [], string $technical_info = "");

Constructor.

Parameters

Name Pass type Value type Default value Description
$message by value string

Error message.

$error_code by value string SmartException::ERR_CODE_SYSTEM_ERROR

Error code.

Since the error texts can be localized, the unique code of the error might be important fo using in comparison.

$error_element by value string ""

Error element.

$error_details by value array []

The details might be useful if the message translations are provided on the client, not on the server, and the message should contain some details that may vary from case to case. In that case, the servers return the message id instead of final text and the details, the client uses the message id, gets the final translated text and substitutes the parameters through the details.

$technical_info by value string ""

Additional technical information. It can be used if it is a programming error and displayed only if the debug mode is active.

Authors

Oleg Schildt

Source code


Method: SmartException::getErrorCode()

public function getErrorCode(): string;

Returns the string error code of the exception.

Details

Since the error texts can be localized, the unique code of the error might be important fo using in comparison.

Returns

string

Returns the error code.

Authors

Oleg Schildt

Source code

See also


Method: SmartException::getErrorDetails()

public function getErrorDetails(): array;

Returns the error details of the exception.

Details

The error details might be useful if the error message translations are provided on the client, not on the server, and the error message should contain some details that may vary from case to case. In that case, the servers return the error message id instead of final text and the details, the client uses the error message id, gets the final translated text and substitutes the parameters through the details.

Returns

array

Returns the error details.

Authors

Oleg Schildt

Source code

See also


Method: SmartException::getErrorElement()

public function getErrorElement(): string;

Returns the error element.

Returns

string

Returns the error element.

Authors

Oleg Schildt

Source code

See also


Method: SmartException::getTechnicalInfo()

public function getTechnicalInfo(): string;

Returns the technical information for the error.

Returns

string

Returns the technical information for the error.

Authors

Oleg Schildt

Source code

See also


Method: SmartException::setErrorElement()

public function setErrorElement(string $error_element): void;

Sets the error element.

Parameters

Name Pass type Value type Default value Description
$error_element by value string

Error element.

Returns

void

Authors

Oleg Schildt

Source code

See also