Skip to content

Commit

Permalink
Display Name of HttpException instead of classname
Browse files Browse the repository at this point in the history
class name is alwarys HttpException, better display the name of the http
error.
  • Loading branch information
cebe committed May 15, 2013
1 parent 116929f commit 762ed2e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions yii/base/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ protected function renderException($exception)
\Yii::$app->runAction($this->errorAction);
} elseif (\Yii::$app instanceof \yii\web\Application) {
if (!headers_sent()) {
$errorCode = $exception instanceof HttpException ? $exception->statusCode : 500;
header("HTTP/1.0 $errorCode " . get_class($exception));
if ($exception instanceof HttpException) {
header('HTTP/1.0 ' . $exception->statusCode . ' ' . $exception->getName());
} else {
header('HTTP/1.0 500 ' . get_class($exception));
}
}
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest') {
\Yii::$app->renderException($exception);
Expand Down

0 comments on commit 762ed2e

Please sign in to comment.