From 103578448db0ce03ea231a10e8234b2d8cb27e34 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 20 Jan 2015 19:23:42 +0100 Subject: One class per file: framework/Exceptions/ --- framework/Exceptions/TPhpErrorException.php | 50 +++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 framework/Exceptions/TPhpErrorException.php (limited to 'framework/Exceptions/TPhpErrorException.php') 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 @@ + + * @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 + * @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 -- cgit v1.2.3