Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Y
yii2bootstrap
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
yii2bootstrap
Commits
01f74b3c
Commit
01f74b3c
authored
May 25, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #408 from yiisoft/error-page
New error/exception page implemented
parents
6e5260d9
a0def9c0
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
564 additions
and
436 deletions
+564
-436
ErrorHandler.php
framework/yii/base/ErrorHandler.php
+114
-159
error.php
framework/yii/views/error.php
+0
-67
callStackItem.php
framework/yii/views/errorHandler/callStackItem.php
+34
-0
main.php
framework/yii/views/errorHandler/main.php
+416
-0
exception.php
framework/yii/views/exception.php
+0
-210
No files found.
framework/yii/base/ErrorHandler.php
View file @
01f74b3c
This diff is collapsed.
Click to expand it.
framework/yii/views/error.php
deleted
100644 → 0
View file @
6e5260d9
<?php
/**
* @var \Exception $exception
* @var \yii\base\ErrorHandler $context
*/
$context
=
$this
->
context
;
$title
=
$context
->
htmlEncode
(
$exception
instanceof
\yii\base\Exception
?
$exception
->
getName
()
:
get_class
(
$exception
));
?>
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
/>
<title>
<?php
echo
$title
?>
</title>
<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>
<h1>
<?php
echo
$title
?>
</h1>
<h2>
<?php
echo
nl2br
(
$context
->
htmlEncode
(
$exception
->
getMessage
()))
?>
</h2>
<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"
>
<?php
echo
date
(
'Y-m-d H:i:s'
,
time
())
?>
<?php
echo
YII_DEBUG
?
$context
->
versionInfo
:
''
?>
</div>
</body>
</html>
framework/yii/views/errorHandler/callStackItem.php
0 → 100644
View file @
01f74b3c
<?php
/**
* @var \yii\base\View $this
* @var string $file
* @var integer $line
* @var integer $index
* @var string[] $lines
* @var integer $begin
* @var integer $end
* @var \yii\base\ErrorHandler $context
*/
$context
=
$this
->
context
;
?>
<li
class=
"
<?php
if
(
!
$context
->
isCoreFile
(
$file
))
echo
'application'
;
?>
call-stack-item"
>
<div
class=
"element-wrap"
>
<div
class=
"element"
>
<span
class=
"number"
>
<?php
echo
(
int
)
$index
;
?>
.
</span>
<span
class=
"text"
>
in
<?php
echo
$context
->
htmlEncode
(
$file
);
?>
</span>
<span
class=
"at"
>
at line
</span>
<span
class=
"line"
>
<?php
echo
(
int
)
$line
;
?>
</span>
</div>
</div>
<div
class=
"code-wrap"
>
<div
class=
"error-line"
style=
"top:
<?php
echo
18
*
(
int
)(
$line
-
$begin
);
?>
px;"
></div>
<?php
for
(
$i
=
$begin
;
$i
<=
$end
;
++
$i
)
:
?>
<div
class=
"hover-line"
style=
"top:
<?php
echo
18
*
(
int
)(
$i
-
$begin
);
?>
px;"
></div>
<?php
endfor
;
?>
<div
class=
"code"
>
<span
class=
"lines"
>
<?php
for
(
$i
=
$begin
;
$i
<=
$end
;
++
$i
)
echo
(
int
)
$i
.
'<br/>'
;
?>
</span>
<pre>
<?php
for
(
$i
=
$begin
;
$i
<=
$end
;
++
$i
)
echo
$context
->
htmlEncode
(
$lines
[
$i
]);
?>
</pre>
</div>
</div>
</li>
framework/yii/views/errorHandler/main.php
0 → 100644
View file @
01f74b3c
This diff is collapsed.
Click to expand it.
framework/yii/views/exception.php
deleted
100644 → 0
View file @
6e5260d9
<?php
/**
* @var \Exception $exception
* @var \yii\base\ErrorHandler $context
*/
$context
=
$this
->
context
;
$title
=
$context
->
htmlEncode
(
$exception
instanceof
\yii\base\Exception
?
$exception
->
getName
()
.
' ('
.
get_class
(
$exception
)
.
')'
:
get_class
(
$exception
));
?>
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
/>
<title>
<?php
echo
$title
?>
</title>
<style>
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"
>
<h1>
<?php
echo
$title
?>
</h1>
<p
class=
"message"
>
<?php
echo
nl2br
(
$context
->
htmlEncode
(
$exception
->
getMessage
()))
?>
</p>
<div
class=
"source"
>
<p
class=
"file"
>
<?php
echo
$context
->
htmlEncode
(
$exception
->
getFile
())
.
'('
.
$exception
->
getLine
()
.
')'
?>
</p>
<?php
if
(
YII_DEBUG
)
$context
->
renderSourceCode
(
$exception
->
getFile
(),
$exception
->
getLine
(),
$context
->
maxSourceLines
)
?>
</div>
<?php
if
(
YII_DEBUG
)
:?>
<
div
class
="
traces
">
<h2>Stack Trace</h2>
<?php
$context->renderTrace
(
$exception->getTrace
())?>
</div>
<?php endif?>
<div class="
version
">
<?php echo date('Y-m-d H:i:s', time())?>
<?php echo YII_DEBUG ?
$context->getVersionInfo
() : ''?>
</div>
</div>
<script>
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;
if (collapsedReg.test(trace.className)) {
trace.className = trace.className.replace('collapsed', 'expanded');
} else {
trace.className = trace.className.replace('expanded', 'collapsed');
}
}
}
}
</script>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment