diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2015-01-20 19:23:42 +0100 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2015-01-20 19:23:42 +0100 |
commit | 103578448db0ce03ea231a10e8234b2d8cb27e34 (patch) | |
tree | d903ab3b16949fa3b75ec96718cf7c4547401932 /framework/Exceptions/TPhpErrorException.php | |
parent | 169950e09cad0e69a7dcbcdabe7ef86086766483 (diff) |
One class per file: framework/Exceptions/
Diffstat (limited to 'framework/Exceptions/TPhpErrorException.php')
-rw-r--r-- | framework/Exceptions/TPhpErrorException.php | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/framework/Exceptions/TPhpErrorException.php b/framework/Exceptions/TPhpErrorException.php new file mode 100644 index 00000000..75218c44 --- /dev/null +++ b/framework/Exceptions/TPhpErrorException.php @@ -0,0 +1,50 @@ +<?php +/** + * Exception classes file + * + * @author Qiang Xue <qiang.xue@gmail.com> + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package System.Exceptions + */ + +/** + * 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)."); + } +}
\ No newline at end of file |