error.php 1.71 KB
Newer Older
1 2 3
<?php
/**
 * @var \Exception $exception
4
 * @var \yii\base\ErrorHandler $handler
5
 */
Qiang Xue committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
if ($exception instanceof \yii\web\HttpException) {
	$code = $exception->statusCode;
} else {
	$code = $exception->getCode();
}
if ($exception instanceof \yii\base\Exception) {
	$name = $exception->getName();
} else {
	$name = 'Error';
}
if ($code) {
	$name .= " (#$code)";
}

if ($exception instanceof \yii\base\UserException) {
	$message = $exception->getMessage();
} else {
	$message = 'An internal server error occurred.';
}
25
?>
Qiang Xue committed
26
<?php if (method_exists($this, 'beginPage')) $this->beginPage(); ?>
27 28 29 30
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
Alexander Makarov committed
31
	<title><?= $handler->htmlEncode($name) ?></title>
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71

	<style>
		body {
			font: normal 9pt "Verdana";
			color: #000;
			background: #fff;
		}

		h1 {
			font: normal 18pt "Verdana";
			color: #f00;
			margin-bottom: .5em;
		}

		h2 {
			font: normal 14pt "Verdana";
			color: #800000;
			margin-bottom: .5em;
		}

		h3 {
			font: bold 11pt "Verdana";
		}

		p {
			font: normal 9pt "Verdana";
			color: #000;
		}

		.version {
			color: gray;
			font-size: 8pt;
			border-top: 1px solid #aaa;
			padding-top: 1em;
			margin-bottom: 1em;
		}
	</style>
</head>

<body>
Alexander Makarov committed
72 73
	<h1><?= $handler->htmlEncode($name) ?></h1>
	<h2><?= nl2br($handler->htmlEncode($message)) ?></h2>
74 75 76 77 78 79 80
	<p>
		The above error occurred while the Web server was processing your request.
	</p>
	<p>
		Please contact us if you think this is a server error. Thank you.
	</p>
	<div class="version">
Alexander Makarov committed
81
		<?= date('Y-m-d H:i:s', time()) ?>
82 83
	</div>
	<?php if (method_exists($this, 'endBody')) $this->endBody(); // to allow injecting code into body (mostly by Yii Debug Toolbar) ?>
84 85
</body>
</html>
Qiang Xue committed
86
<?php if (method_exists($this, 'endPage')) $this->endPage(); ?>