mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-10 23:50:38 +08:00
Fixes #5954: yii message command now shows user friendly error if it's not able to parse source file
This commit is contained in:
@@ -31,6 +31,7 @@ Yii Framework 2 Change Log
|
|||||||
- Enh #5735: Added `yii\bootstrap\Tabs::renderTabContent` to support manually rendering tab contents (RomeroMsk)
|
- Enh #5735: Added `yii\bootstrap\Tabs::renderTabContent` to support manually rendering tab contents (RomeroMsk)
|
||||||
- Enh #5770: Added more PHP error names for `ErrorException` (mongosoft)
|
- Enh #5770: Added more PHP error names for `ErrorException` (mongosoft)
|
||||||
- Enh #5806: Allow `Html::encode()` to be used when the application is not started (qiangxue)
|
- Enh #5806: Allow `Html::encode()` to be used when the application is not started (qiangxue)
|
||||||
|
- Enh #5954: `yii message` command now shows user friendly error if it's not able to parse source file (samdark)
|
||||||
- Enh: `Console::confirm()` now uses `Console::stdout()` instead of `echo` to be consistent with all other functions (cebe)
|
- Enh: `Console::confirm()` now uses `Console::stdout()` instead of `echo` to be consistent with all other functions (cebe)
|
||||||
- Enh: `yii\rbac\DbManager` migration now uses database component specified in component settings instead of always using default `db` (samdark)
|
- Enh: `yii\rbac\DbManager` migration now uses database component specified in component settings instead of always using default `db` (samdark)
|
||||||
- Chg #3630: `yii\db\Command::queryInternal()` is now protected (samdark)
|
- Chg #3630: `yii\db\Command::queryInternal()` is now protected (samdark)
|
||||||
|
|||||||
@@ -8,8 +8,10 @@
|
|||||||
namespace yii\console\controllers;
|
namespace yii\console\controllers;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
|
use yii\base\ErrorException;
|
||||||
use yii\console\Controller;
|
use yii\console\Controller;
|
||||||
use yii\console\Exception;
|
use yii\console\Exception;
|
||||||
|
use yii\helpers\Console;
|
||||||
use yii\helpers\FileHelper;
|
use yii\helpers\FileHelper;
|
||||||
use yii\helpers\VarDumper;
|
use yii\helpers\VarDumper;
|
||||||
use yii\i18n\GettextPoFile;
|
use yii\i18n\GettextPoFile;
|
||||||
@@ -258,7 +260,17 @@ class MessageController extends Controller
|
|||||||
for ($i = 0; $i < $n; ++$i) {
|
for ($i = 0; $i < $n; ++$i) {
|
||||||
$category = substr($matches[$i][1], 1, -1);
|
$category = substr($matches[$i][1], 1, -1);
|
||||||
$message = $matches[$i][2];
|
$message = $matches[$i][2];
|
||||||
$messages[$category][] = eval("return {$message};"); // use eval to eliminate quote escape
|
try {
|
||||||
|
$messages[$category][] = eval("return {$message};"); // use eval to eliminate quote escape
|
||||||
|
} catch (ErrorException $e) {
|
||||||
|
$category = Console::ansiFormat($category, [Console::FG_CYAN]);
|
||||||
|
$message = Console::ansiFormat($message, [Console::FG_CYAN]);
|
||||||
|
$fileName = Console::ansiFormat($fileName, [Console::FG_CYAN]);
|
||||||
|
$error = Console::ansiFormat($e->getMessage(), [Console::FG_RED]);
|
||||||
|
|
||||||
|
$this->stdout("Failed parsing $fileName, $message in $category category:\n" . $error . "\n");
|
||||||
|
Yii::$app->end(self::EXIT_CODE_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user