diff options
Diffstat (limited to 'framework/Exceptions/TException.php')
-rw-r--r-- | framework/Exceptions/TException.php | 286 |
1 files changed, 1 insertions, 285 deletions
diff --git a/framework/Exceptions/TException.php b/framework/Exceptions/TException.php index 24dbdb0f..80dd01f1 100644 --- a/framework/Exceptions/TException.php +++ b/framework/Exceptions/TException.php @@ -122,288 +122,4 @@ class TException extends Exception { $this->message=$message; } -} - -/** - * TSystemException class - * - * TSystemException is the base class for all framework-level exceptions. - * - * @author Qiang Xue <qiang.xue@gmail.com> - * @package System.Exceptions - * @since 3.0 - */ -class TSystemException extends TException -{ -} - -/** - * TApplicationException class - * - * TApplicationException is the base class for all user application-level exceptions. - * - * @author Qiang Xue <qiang.xue@gmail.com> - * @package System.Exceptions - * @since 3.0 - */ -class TApplicationException extends TException -{ -} - -/** - * TInvalidOperationException class - * - * TInvalidOperationException represents an exception caused by invalid operations. - * - * @author Qiang Xue <qiang.xue@gmail.com> - * @package System.Exceptions - * @since 3.0 - */ -class TInvalidOperationException extends TSystemException -{ -} - -/** - * TInvalidDataTypeException class - * - * TInvalidDataTypeException represents an exception caused by invalid data type. - * - * @author Qiang Xue <qiang.xue@gmail.com> - * @package System.Exceptions - * @since 3.0 - */ -class TInvalidDataTypeException extends TSystemException -{ -} - -/** - * TInvalidDataValueException class - * - * TInvalidDataValueException represents an exception caused by invalid data value. - * - * @author Qiang Xue <qiang.xue@gmail.com> - * @package System.Exceptions - * @since 3.0 - */ -class TInvalidDataValueException extends TSystemException -{ -} - -/** - * TConfigurationException class - * - * TConfigurationException represents an exception caused by invalid configurations, - * such as error in an application configuration file or control template file. - * - * @author Qiang Xue <qiang.xue@gmail.com> - * @package System.Exceptions - * @since 3.0 - */ -class TConfigurationException extends TSystemException -{ -} - -/** - * TTemplateException class - * - * TTemplateException represents an exception caused by invalid template syntax. - * - * @author Qiang Xue <qiang.xue@gmail.com> - * @package System.Exceptions - * @since 3.1 - */ -class TTemplateException extends TConfigurationException -{ - private $_template=''; - private $_lineNumber=0; - private $_fileName=''; - - /** - * @return string the template source code that causes the exception. This is empty if {@link getTemplateFile TemplateFile} is not empty. - */ - public function getTemplateSource() - { - return $this->_template; - } - - /** - * @param string the template source code that causes the exception - */ - public function setTemplateSource($value) - { - $this->_template=$value; - } - - /** - * @return string the template file that causes the exception. This could be empty if the template is an embedded template. In this case, use {@link getTemplateSource TemplateSource} to obtain the actual template content. - */ - public function getTemplateFile() - { - return $this->_fileName; - } - - /** - * @param string the template file that causes the exception - */ - public function setTemplateFile($value) - { - $this->_fileName=$value; - } - - /** - * @return integer the line number at which the template has error - */ - public function getLineNumber() - { - return $this->_lineNumber; - } - - /** - * @param integer the line number at which the template has error - */ - public function setLineNumber($value) - { - $this->_lineNumber=TPropertyValue::ensureInteger($value); - } -} - -/** - * TIOException class - * - * TIOException represents an exception related with improper IO operations. - * - * @author Qiang Xue <qiang.xue@gmail.com> - * @package System.Exceptions - * @since 3.0 - */ -class TIOException extends TSystemException -{ -} - -/** - * TDbException class - * - * TDbException represents an exception related with DB operations. - * - * @author Qiang Xue <qiang.xue@gmail.com> - * @package System.Exceptions - * @since 3.0 - */ -class TDbException extends TSystemException -{ -} - -/** - * TDbConnectionException class - * - * TDbConnectionException represents an exception caused by DB connection failure. - * - * @author Qiang Xue <qiang.xue@gmail.com> - * @package System.Exceptions - * @since 3.0 - */ -class TDbConnectionException extends TDbException -{ -} - -/** - * TNotSupportedException class - * - * TNotSupportedException represents an exception caused by using an unsupported PRADO feature. - * - * @author Qiang Xue <qiang.xue@gmail.com> - * @package System.Exceptions - * @since 3.0 - */ -class TNotSupportedException extends TSystemException -{ -} - -/** - * TPhpErrorException class - * - * TPhpErrorException represents an exception caused by a PHP error. - * This exception is mainly thrown within a PHP error handler. - * - * @author Qiang Xue <qiang.xue@gmail.com> - * @package System.Exceptions - * @since 3.0 - */ -class TPhpErrorException extends TSystemException -{ - /** - * Constructor. - * @param integer error number - * @param string error string - * @param string error file - * @param integer error line number - */ - public function __construct($errno,$errstr,$errfile,$errline) - { - static $errorTypes=array( - E_ERROR => "Error", - E_WARNING => "Warning", - E_PARSE => "Parsing Error", - E_NOTICE => "Notice", - E_CORE_ERROR => "Core Error", - E_CORE_WARNING => "Core Warning", - E_COMPILE_ERROR => "Compile Error", - E_COMPILE_WARNING => "Compile Warning", - E_USER_ERROR => "User Error", - E_USER_WARNING => "User Warning", - E_USER_NOTICE => "User Notice", - E_STRICT => "Runtime Notice" - ); - $errorType=isset($errorTypes[$errno])?$errorTypes[$errno]:'Unknown Error'; - parent::__construct("[$errorType] $errstr (@line $errline in file $errfile)."); - } -} - - -/** - * THttpException class - * - * THttpException represents an exception that is caused by invalid operations - * of end-users. The {@link getStatusCode StatusCode} gives the type of HTTP error. - * It is used by {@link TErrorHandler} to provide different error output to users. - * - * @author Qiang Xue <qiang.xue@gmail.com> - * @package System.Exceptions - * @since 3.0 - */ -class THttpException extends TSystemException -{ - private $_statusCode; - - /** - * Constructor. - * @param integer HTTP status code, such as 404, 500, etc. - * @param string error message. This can be a string that is listed - * in the message file. If so, the message in the preferred language - * will be used as the error message. Any rest parameters will be used - * to replace placeholders ({0}, {1}, {2}, etc.) in the message. - */ - public function __construct($statusCode,$errorMessage) - { - $this->_statusCode=$statusCode; - $this->setErrorCode($errorMessage); - $errorMessage=$this->translateErrorMessage($errorMessage); - $args=func_get_args(); - array_shift($args); - array_shift($args); - $n=count($args); - $tokens=array(); - for($i=0;$i<$n;++$i) - $tokens['{'.$i.'}']=TPropertyValue::ensureString($args[$i]); - parent::__construct(strtr($errorMessage,$tokens)); - } - - /** - * @return integer HTTP status code, such as 404, 500, etc. - */ - public function getStatusCode() - { - return $this->_statusCode; - } -} - +}
\ No newline at end of file |