Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
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
PSDI Army
yii2
Commits
7511de6c
Commit
7511de6c
authored
May 12, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added errorInfo to exception views
parent
a2aa20f1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
5 deletions
+25
-5
ErrorHandler.php
framework/console/ErrorHandler.php
+5
-2
exception.php
framework/views/errorHandler/exception.php
+13
-2
previousException.php
framework/views/errorHandler/previousException.php
+3
-0
ErrorHandler.php
framework/web/ErrorHandler.php
+4
-1
No files found.
framework/console/ErrorHandler.php
View file @
7511de6c
...
...
@@ -42,8 +42,11 @@ class ErrorHandler extends \yii\base\ErrorHandler
$message
.=
$this
->
formatMessage
(
" '"
.
get_class
(
$exception
)
.
"'"
,
[
Console
::
BOLD
,
Console
::
FG_BLUE
])
.
" with message "
.
$this
->
formatMessage
(
"'
{
$exception
->
getMessage
()
}
'"
,
[
Console
::
BOLD
])
//. "\n"
.
"
\n\n
in "
.
dirname
(
$exception
->
getFile
())
.
DIRECTORY_SEPARATOR
.
$this
->
formatMessage
(
basename
(
$exception
->
getFile
()),
[
Console
::
BOLD
])
.
':'
.
$this
->
formatMessage
(
$exception
->
getLine
(),
[
Console
::
BOLD
,
Console
::
FG_YELLOW
])
.
"
\n\n
"
.
$this
->
formatMessage
(
"Stack trace:
\n
"
,
[
Console
::
BOLD
])
.
$exception
->
getTraceAsString
();
.
':'
.
$this
->
formatMessage
(
$exception
->
getLine
(),
[
Console
::
BOLD
,
Console
::
FG_YELLOW
])
.
"
\n
"
;
if
(
$exception
instanceof
\yii\db\Exception
&&
!
empty
(
$exception
->
errorInfo
))
{
$message
.=
"
\n
"
.
$this
->
formatMessage
(
"Error Info:
\n
"
,
[
Console
::
BOLD
])
.
print_r
(
$exception
->
errorInfo
,
true
);
}
$message
.=
"
\n
"
.
$this
->
formatMessage
(
"Stack trace:
\n
"
,
[
Console
::
BOLD
])
.
$exception
->
getTraceAsString
();
}
else
{
$message
=
$this
->
formatMessage
(
'Error: '
)
.
$exception
->
getMessage
();
}
...
...
framework/views/errorHandler/exception.php
View file @
7511de6c
...
...
@@ -87,6 +87,9 @@ html,body{
font-size
:
20px
;
line-height
:
1.25
;
}
.header
pre
{
margin
:
10px
0
;
}
/* previous exceptions */
.header
.previous
{
...
...
@@ -104,8 +107,8 @@ html,body{
filter
:
progid
:
DXImageTransform
.
Microsoft
.
BasicImage
(
mirror
=
1
);
font-size
:
26px
;
position
:
absolute
;
margin-top
:
-
5
px
;
margin-left
:
-
25
px
;
margin-top
:
-
3
px
;
margin-left
:
-
30
px
;
color
:
#e51717
;
}
.header
.previous
h2
{
...
...
@@ -130,6 +133,10 @@ html,body{
font-size
:
14px
;
color
:
#aaa
;
}
.header
.previous
pre
{
font-size
:
14px
;
margin
:
10px
0
;
}
/* call stack */
.call-stack
{
...
...
@@ -348,6 +355,10 @@ html,body{
<?php
endif
;
?>
<h2>
<?=
nl2br
(
$handler
->
htmlEncode
(
$exception
->
getMessage
()))
?>
</h2>
<?php
if
(
$exception
instanceof
\yii\db\Exception
&&
!
empty
(
$exception
->
errorInfo
))
{
echo
'<pre>Error Info: '
.
print_r
(
$exception
->
errorInfo
,
true
)
.
'</pre>'
;
}
?>
<?=
$handler
->
renderPreviousExceptions
(
$exception
)
?>
</div>
...
...
framework/views/errorHandler/previousException.php
View file @
7511de6c
...
...
@@ -18,5 +18,8 @@
</h2>
<h3>
<?=
nl2br
(
$handler
->
htmlEncode
(
$exception
->
getMessage
()))
?>
</h3>
<p>
in
<span
class=
"file"
>
<?=
$exception
->
getFile
()
?>
</span>
at line
<span
class=
"line"
>
<?=
$exception
->
getLine
()
?>
</span></p>
<?php
if
(
$exception
instanceof
\yii\db\Exception
&&
!
empty
(
$exception
->
errorInfo
))
{
echo
'<pre>Error Info: '
.
print_r
(
$exception
->
errorInfo
,
true
)
.
'</pre>'
;
}
?>
<?=
$handler
->
renderPreviousExceptions
(
$exception
)
?>
</div>
framework/web/ErrorHandler.php
View file @
7511de6c
...
...
@@ -127,6 +127,9 @@ class ErrorHandler extends \yii\base\ErrorHandler
}
if
(
YII_DEBUG
)
{
$array
[
'stack-trace'
]
=
explode
(
"
\n
"
,
$exception
->
getTraceAsString
());
if
(
$exception
instanceof
\yii\db\Exception
)
{
$array
[
'error-info'
]
=
$this
->
errorInfo
;
}
}
if
((
$prev
=
$exception
->
getPrevious
())
!==
null
)
{
$array
[
'previous'
]
=
$this
->
convertExceptionToArray
(
$prev
);
...
...
@@ -169,7 +172,7 @@ class ErrorHandler extends \yii\base\ErrorHandler
$page
=
$this
->
htmlEncode
(
strtolower
(
str_replace
(
'\\'
,
'-'
,
$class
)));
$url
=
"http://www.yiiframework.com/doc-2.0/
$page
.html"
;
if
(
isset
(
$method
))
{
$url
.=
"#
$method
-detail"
;
$url
.=
"#
$method
()
-detail"
;
}
return
'<a href="'
.
$url
.
'" target="_blank">'
.
$text
.
'</a>'
;
...
...
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