exception.php 3.95 KB
Newer Older
Qiang Xue committed
1 2 3
<?php
/**
 * @var \Exception $exception
4
 * @var \yii\base\ErrorHandler $context
Qiang Xue committed
5
 */
6
$context = $this->context;
Qiang Xue committed
7 8 9 10
?>
<!DOCTYPE html>
<html>
<head>
11 12 13
	<meta charset="utf-8" />
	<title><?php echo get_class($exception)?></title>
	<style>
Qiang Xue committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
	html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent;margin:0;padding:0;}
	body{line-height:1;}
	ol,ul{list-style:none;}
	blockquote,q{quotes:none;}
	blockquote:before,blockquote:after,q:before,q:after{content:none;}
	:focus{outline:0;}
	ins{text-decoration:none;}
	del{text-decoration:line-through;}
	table{border-collapse:collapse;border-spacing:0;}

	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";
	}

	pre {
		font: normal 11pt Menlo, Consolas, "Lucida Console", Monospace;
	}

	pre span.error {
		display: block;
		background: #fce3e3;
	}

	pre span.ln {
		color: #999;
		padding-right: 0.5em;
		border-right: 1px solid #ccc;
	}

	pre span.error-ln {
		font-weight: bold;
	}

	.container {
		margin: 1em 4em;
	}

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

	.message {
		color: #000;
		padding: 1em;
		font-size: 11pt;
		background: #f3f3f3;
		-webkit-border-radius: 10px;
		-moz-border-radius: 10px;
		border-radius: 10px;
		margin-bottom: 1em;
		line-height: 160%;
	}

	.source {
		margin-bottom: 1em;
	}

	.code pre {
		background-color: #ffe;
		margin: 0.5em 0;
		padding: 0.5em;
		line-height: 125%;
		border: 1px solid #eee;
	}

	.source .file {
		margin-bottom: 1em;
		font-weight: bold;
	}

	.traces {
		margin: 2em 0;
	}

	.trace {
		margin: 0.5em 0;
		padding: 0.5em;
	}

	.trace.app {
		border: 1px dashed #c00;
	}

	.trace .number {
		text-align: right;
		width: 2em;
		padding: 0.5em;
	}

	.trace .content {
		padding: 0.5em;
	}

	.trace .plus,
	.trace .minus {
		display: inline;
		vertical-align: middle;
		text-align: center;
		border: 1px solid #000;
		color: #000;
		font-size: 10px;
		line-height: 10px;
		margin: 0;
		padding: 0 1px;
		width: 10px;
		height: 10px;
	}

	.trace.collapsed .minus,
	.trace.expanded .plus,
	.trace.collapsed pre {
		display: none;
	}

	.trace-file {
		cursor: pointer;
		padding: 0.2em;
	}

	.trace-file:hover {
		background: #f0ffff;
	}
	</style>
</head>

<body>
<div class="container">
163
	<h1><?php echo get_class($exception)?></h1>
Qiang Xue committed
164 165

	<p class="message">
166
		<?php echo nl2br($context->htmlEncode($exception->getMessage()))?>
Qiang Xue committed
167 168 169 170
	</p>

	<div class="source">
		<p class="file">
171
			<?php echo $context->htmlEncode($exception->getFile()) . '(' . $exception->getLine() . ')'?>
Qiang Xue committed
172
		</p>
173
		<?php if (YII_DEBUG) $context->renderSourceCode($exception->getFile(), $exception->getLine(), $context->maxSourceLines)?>
Qiang Xue committed
174 175
	</div>

176
	<?php if (YII_DEBUG):?>
Qiang Xue committed
177 178
	<div class="traces">
		<h2>Stack Trace</h2>
179
		<?php $context->renderTrace($exception->getTrace())?>
Qiang Xue committed
180
	</div>
181
	<?php endif?>
Qiang Xue committed
182 183

	<div class="version">
184
		<?php echo date('Y-m-d H:i:s', time())?>
185
		<?php echo YII_DEBUG ? $context->versionInfo : ''?>
Qiang Xue committed
186 187 188
	</div>
</div>

189
<script>
Qiang Xue committed
190 191 192 193 194 195 196 197
var traceReg = new RegExp("(^|\\s)trace-file(\\s|$)");
var collapsedReg = new RegExp("(^|\\s)collapsed(\\s|$)");

var e = document.getElementsByTagName("div");
for(var j=0,len=e.length;j<len;j++){
	if(traceReg.test(e[j].className)){
		e[j].onclick = function(){
			var trace = this.parentNode.parentNode;
198
			if(collapsedReg.test(trace.className)){
Qiang Xue committed
199
				trace.className = trace.className.replace("collapsed", "expanded");
200 201
			}
			else{
Qiang Xue committed
202
				trace.className = trace.className.replace("expanded", "collapsed");
203
			}
Qiang Xue committed
204 205 206 207 208 209 210
		}
	}
}
</script>

</body>
</html>