From 5f9e88d40fd9e4ad0deef6f22276a50b075dad83 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 9 Jan 2014 15:28:09 +0400 Subject: [PATCH] Better exception message when class cannot be loaded --- framework/CHANGELOG.md | 1 + framework/yii/BaseYii.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index bf9e59b..8b7780a 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -62,6 +62,7 @@ Yii Framework 2 Change Log - Enh: Sort and Pagination can now create absolute URLs (cebe) - Enh: Added support for using array-typed arguments for console commands (qiangxue) - Enh: Added support for installing packages conforming to PSR-4 standard (qiangxue) +- Enh: Better exception message when class cannot be loaded (samdark) - Chg #1519: `yii\web\User::loginRequired()` now returns the `Response` object instead of exiting the application (qiangxue) - Chg #1586: `QueryBuilder::buildLikeCondition()` will now escape special characters and use percentage characters by default (qiangxue) - Chg #1610: `Html::activeCheckboxList()` and `Html::activeRadioList()` will submit an empty string if no checkbox/radio is selected (qiangxue) diff --git a/framework/yii/BaseYii.php b/framework/yii/BaseYii.php index b371875..decffe0 100644 --- a/framework/yii/BaseYii.php +++ b/framework/yii/BaseYii.php @@ -296,7 +296,7 @@ class BaseYii include($classFile); if (YII_DEBUG && !class_exists($className, false) && !interface_exists($className, false) && !trait_exists($className, false)) { - throw new UnknownClassException("Unable to find '$className' in file: $classFile"); + throw new UnknownClassException("Unable to find '$className' in file: $classFile. Namespace missing?"); } }