Commit 767a78f8 by Alexander Makarov

better handling of errors during rendering an error

parent 2a12fdbc
......@@ -411,7 +411,7 @@ class Application extends Module
error_log($exception);
if (($handler = $this->getErrorHandler()) !== null) {
@$handler->handle($exception);
$handler->handle($exception);
} else {
$this->renderException($exception);
}
......
......@@ -81,7 +81,10 @@ class ErrorHandler extends Component
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest') {
\Yii::$app->renderException($exception);
} else {
try {
if(YII_DEBUG) {
ini_set('display_errors', 1);
}
$view = new View;
if (!YII_DEBUG || $exception instanceof UserException) {
$viewName = $this->errorView;
......@@ -91,9 +94,9 @@ class ErrorHandler extends Component
echo $view->renderFile($viewName, array(
'exception' => $exception,
), $this);
}
catch (\Exception $e) {
\Yii::$app->renderException($e);
if(YII_DEBUG) {
ini_set('display_errors', 0);
}
}
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment