diff options
Diffstat (limited to 'lib/prado/framework/Exceptions')
-rw-r--r-- | lib/prado/framework/Exceptions/TErrorHandler.php | 9 | ||||
-rw-r--r-- | lib/prado/framework/Exceptions/TException.php | 13 | ||||
-rw-r--r-- | lib/prado/framework/Exceptions/messages/messages.txt | 1 |
3 files changed, 20 insertions, 3 deletions
diff --git a/lib/prado/framework/Exceptions/TErrorHandler.php b/lib/prado/framework/Exceptions/TErrorHandler.php index f9a120a..76f7396 100644 --- a/lib/prado/framework/Exceptions/TErrorHandler.php +++ b/lib/prado/framework/Exceptions/TErrorHandler.php @@ -4,7 +4,7 @@ * * @author Qiang Xue <qiang.xue@gmail.com> * @link https://github.com/pradosoft/prado - * @copyright Copyright © 2005-2015 The PRADO Group + * @copyright Copyright © 2005-2016 The PRADO Group * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT * @package System.Exceptions */ @@ -345,7 +345,12 @@ class TErrorHandler extends TModule // if PHP exception, we want to show the 2nd stack level context // because the 1st stack level is of little use (it's in error handler) if($exception instanceof TPhpErrorException) - $result=isset($trace[0]['file'])?$trace[0]:$trace[1]; + { + if(isset($trace[0]['file'])) + $result=$trace[0]; + elseif(isset($trace[1])) + $result=$trace[1]; + } else if($exception instanceof TInvalidOperationException) { // in case of getter or setter error, find out the exact file and row diff --git a/lib/prado/framework/Exceptions/TException.php b/lib/prado/framework/Exceptions/TException.php index 651adb5..2c915a4 100644 --- a/lib/prado/framework/Exceptions/TException.php +++ b/lib/prado/framework/Exceptions/TException.php @@ -4,7 +4,7 @@ * * @author Qiang Xue <qiang.xue@gmail.com> * @link https://github.com/pradosoft/prado - * @copyright Copyright © 2005-2015 The PRADO Group + * @copyright Copyright © 2005-2016 The PRADO Group * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT * @package System.Exceptions */ @@ -357,6 +357,17 @@ class TPhpErrorException extends TSystemException $errorType=isset($errorTypes[$errno])?$errorTypes[$errno]:'Unknown Error'; parent::__construct("[$errorType] $errstr (@line $errline in file $errfile)."); } + + /** + * Returns if error is one of fatal type. + * + * @param array $error error got from error_get_last() + * @return boolean if error is one of fatal type + */ + public static function isFatalError($error) + { + return isset($error['type']) && in_array($error['type'], array(E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING)); + } } diff --git a/lib/prado/framework/Exceptions/messages/messages.txt b/lib/prado/framework/Exceptions/messages/messages.txt index 46dde55..8958014 100644 --- a/lib/prado/framework/Exceptions/messages/messages.txt +++ b/lib/prado/framework/Exceptions/messages/messages.txt @@ -210,6 +210,7 @@ page_statepersister_invalid = Page state persister must implement IPageStateP page_csmanagerclass_invalid = ClientScriptManager class '{0}' must be an instance of TClientScriptManager. csmanager_pradoscript_invalid = Unknown Prado script library name '{0}'. +csmanager_pradostyle_invalid = Unknown Prado style library name '{0}'. csmanager_invalid_packages = Unkownn packages '{1}' for javascript packages defined in '{0}'. Valid packages are '{2}'. contentplaceholder_id_required = TContentPlaceHolder must have an ID. |