<?php
namespace Moto\System; use Moto; class Exception extends Moto\Exception { const ERROR_BAD_REQUEST_MESSAGE = 'COMMON.ERROR_MESSAGE.BAD_REQUEST'; const ERROR_BAD_REQUEST_CODE = 400; const ERROR_ACCESS_DENIED_MESSAGE = 'COMMON.ERROR_MESSAGE.ACCESS_DENIED'; const ERROR_ACCESS_DENIED_CODE = 403; const ERROR_ACCOUNT_NOT_ACTIVATED_MESSAGE = 'COMMON.ERROR_MESSAGE.ACCOUNT_NOT_ACTIVATED'; const ERROR_ACCOUNT_NOT_ACTIVATED_CODE = 500; const ERROR_EXTENSION_NOT_EXISTS_MESSAGE = 'COMMON.ERROR_MESSAGE.EXTENSION_NOT_EXISTS'; const ERROR_EXTENSION_NOT_EXISTS_CODE = 500; const ERROR_SESSION_EXPIRED_MESSAGE = 'COMMON.ERROR_MESSAGE.SESSION_EXPIRED'; const ERROR_SESSION_EXPIRED_CODE = 403; const ERROR_NOT_FOUND_MESSAGE = 'COMMON.ERROR_MESSAGE.NOT_FOUND'; const ERROR_NOT_FOUND_CODE = 404; const ERROR_PERMISSION_DENIED_MESSAGE = 'COMMON.ERROR_MESSAGE.PERMISSION_DENIED'; const ERROR_PERMISSION_DENIED_CODE = 403; const ERROR_INSTALLATION_FAILED_MESSAGE = 'COMMON.ERROR_MESSAGE.INSTALLATION_FAILED'; const ERROR_INSTALLATION_FAILED_CODE = 500; const ERROR_AUTHORIZATION_DATA_MESSAGE = 'COMMON.ERROR_MESSAGE.INCORRECT_AUTHORIZATION_DATA'; const ERROR_AUTHORIZATION_DATA_CODE = 403; const ERROR_MAIL_NOT_SENT = 'COMMON.ERROR_MESSAGE.SEND_MAIL'; const ERROR_CAN_NOT_DELETE_MESSAGE = 'COMMON.MESSAGES.DELETE_ERROR'; const ERROR_ACTION_NOT_ACCEPTABLE_CODE = 406; const ERROR_FAILED_DEPENDENCY_MESSAGE = 'COMMON.MESSAGES.FAILED_DEPENDENCY'; const ERROR_FAILED_DEPENDENCY_CODE = 424; const ERROR_CONFLICT_MESSAGE = 'COMMON.MESSAGES.CONFLICT'; const ERROR_CONFLICT_CODE = 409; const ERROR_NEED_CONFIRMATION = 'COMMON.MESSAGES.NEED_CONFIRMATION'; protected function _postConstruct() { if ($this->message === static::ERROR_ACCESS_DENIED_MESSAGE) { if (Moto\Authentication\Service::isSessionExpired()) { $this->message = static::ERROR_SESSION_EXPIRED_MESSAGE; $this->code = static::ERROR_SESSION_EXPIRED_CODE; } } } protected function _logging() { Moto\System\Log::error($this->getMessage() . ' ( ' . $this->getCode() . ' )'); } } 