From 0ef40b28d1c11a30a95a831552123bc5e053179b Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sun, 26 May 2013 02:34:38 +0200 Subject: [PATCH] adjusted Exception error page header and title make sure all information is displayed Fixes comment by @creocoder issue #408 https://github.com/yiisoft/yii2/pull/408#issuecomment-18454179 --- framework/yii/base/ErrorHandler.php | 5 +++-- framework/yii/views/errorHandler/main.php | 36 +++++++++++++++++++------------ 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/framework/yii/base/ErrorHandler.php b/framework/yii/base/ErrorHandler.php index 7db5161..8997b9e 100644 --- a/framework/yii/base/ErrorHandler.php +++ b/framework/yii/base/ErrorHandler.php @@ -152,11 +152,12 @@ class ErrorHandler extends Component /** * Creates HTML containing link to the page with the information on given HTTP status code. * @param integer $statusCode to be used to generate information link. + * @param string $statusDescription Description to display after the the status code. * @return string generated HTML with HTTP status code information. */ - public function createHttpStatusLink($statusCode) + public function createHttpStatusLink($statusCode, $statusDescription) { - return '' . (int)$statusCode . ''; + return 'HTTP ' . (int)$statusCode . ' – ' . $statusDescription . ''; } /** diff --git a/framework/yii/views/errorHandler/main.php b/framework/yii/views/errorHandler/main.php index f63f246..93fa589 100644 --- a/framework/yii/views/errorHandler/main.php +++ b/framework/yii/views/errorHandler/main.php @@ -13,11 +13,15 @@ $context = $this->context; - - <?php echo $context->htmlEncode($exception->getName() . ' – ' . get_class($exception)); ?> - - <?php echo $context->htmlEncode(get_class($exception)); ?> - + <?php + if ($exception instanceof \yii\base\HttpException) { + echo (int) $exception->statusCode . ' ' . $context->htmlEncode($exception->getName()); + } elseif ($exception instanceof \yii\base\Exception) { + echo $context->htmlEncode($exception->getName() . ' – ' . get_class($exception)); + } else { + echo $context->htmlEncode(get_class($exception)); + } + ?>