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
340278b5
Commit
340278b5
authored
Apr 30, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #3183: fixed regression after #3175
parent
468e4191
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
10 deletions
+30
-10
error.php
framework/views/errorHandler/error.php
+2
-3
exception.php
framework/views/errorHandler/exception.php
+12
-5
previousException.php
framework/views/errorHandler/previousException.php
+3
-2
ErrorHandler.php
framework/web/ErrorHandler.php
+13
-0
No files found.
framework/views/errorHandler/error.php
View file @
340278b5
...
@@ -8,9 +8,8 @@ if ($exception instanceof \yii\web\HttpException) {
...
@@ -8,9 +8,8 @@ if ($exception instanceof \yii\web\HttpException) {
}
else
{
}
else
{
$code
=
$exception
->
getCode
();
$code
=
$exception
->
getCode
();
}
}
if
(
$exception
instanceof
\yii\base\Exception
)
{
$name
=
$handler
->
getExceptionName
(
$exception
);
$name
=
$exception
->
getName
();
if
(
$name
===
null
)
{
}
else
{
$name
=
'Error'
;
$name
=
'Error'
;
}
}
if
(
$code
)
{
if
(
$code
)
{
...
...
framework/views/errorHandler/exception.php
View file @
340278b5
...
@@ -12,13 +12,17 @@
...
@@ -12,13 +12,17 @@
<meta
charset=
"utf-8"
/>
<meta
charset=
"utf-8"
/>
<title>
<?php
<title>
<?php
$name
=
$handler
->
getExceptionName
(
$exception
);
if
(
$exception
instanceof
\yii\web\HttpException
)
{
if
(
$exception
instanceof
\yii\web\HttpException
)
{
echo
(
int
)
$exception
->
statusCode
.
' '
.
$handler
->
htmlEncode
(
$exception
->
getName
());
echo
(
int
)
$exception
->
statusCode
.
' '
.
$handler
->
htmlEncode
(
$name
);
}
elseif
(
$exception
instanceof
\yii\base\Exception
)
{
}
else
{
echo
$handler
->
htmlEncode
(
$exception
->
getName
()
.
' – '
.
get_class
(
$exception
));
$name
=
$handler
->
getExceptionName
(
$exception
);
if
(
$name
!==
null
)
{
echo
$handler
->
htmlEncode
(
$name
.
' – '
.
get_class
(
$exception
));
}
else
{
}
else
{
echo
$handler
->
htmlEncode
(
get_class
(
$exception
));
echo
$handler
->
htmlEncode
(
get_class
(
$exception
));
}
}
}
?>
</title>
?>
</title>
<style
type=
"text/css"
>
<style
type=
"text/css"
>
...
@@ -331,12 +335,15 @@ html,body{
...
@@ -331,12 +335,15 @@ html,body{
if
(
$exception
instanceof
\yii\web\HttpException
)
{
if
(
$exception
instanceof
\yii\web\HttpException
)
{
echo
'<span>'
.
$handler
->
createHttpStatusLink
(
$exception
->
statusCode
,
$handler
->
htmlEncode
(
$exception
->
getName
()))
.
'</span>'
;
echo
'<span>'
.
$handler
->
createHttpStatusLink
(
$exception
->
statusCode
,
$handler
->
htmlEncode
(
$exception
->
getName
()))
.
'</span>'
;
echo
' – '
.
$handler
->
addTypeLinks
(
get_class
(
$exception
));
echo
' – '
.
$handler
->
addTypeLinks
(
get_class
(
$exception
));
}
elseif
(
$exception
instanceof
\yii\base\Exception
)
{
}
else
{
echo
'<span>'
.
$handler
->
htmlEncode
(
$exception
->
getName
())
.
'</span>'
;
$name
=
$handler
->
getExceptionName
(
$exception
);
if
(
$name
!==
null
)
{
echo
'<span>'
.
$handler
->
htmlEncode
(
$name
)
.
'</span>'
;
echo
' – '
.
$handler
->
addTypeLinks
(
get_class
(
$exception
));
echo
' – '
.
$handler
->
addTypeLinks
(
get_class
(
$exception
));
}
else
{
}
else
{
echo
'<span>'
.
$handler
->
htmlEncode
(
get_class
(
$exception
))
.
'</span>'
;
echo
'<span>'
.
$handler
->
htmlEncode
(
get_class
(
$exception
))
.
'</span>'
;
}
}
}
?>
</h1>
?>
</h1>
<?php
endif
;
?>
<?php
endif
;
?>
<h2>
<?=
nl2br
(
$handler
->
htmlEncode
(
$exception
->
getMessage
()))
?>
</h2>
<h2>
<?=
nl2br
(
$handler
->
htmlEncode
(
$exception
->
getMessage
()))
?>
</h2>
...
...
framework/views/errorHandler/previousException.php
View file @
340278b5
...
@@ -8,8 +8,9 @@
...
@@ -8,8 +8,9 @@
<span
class=
"arrow"
>
↵
</span>
<span
class=
"arrow"
>
↵
</span>
<h2>
<h2>
<span>
Caused by:
</span>
<span>
Caused by:
</span>
<?php
if
(
$exception
instanceof
\yii\base\Exception
)
:
?>
<?php
$name
=
$handler
->
getExceptionName
(
$exception
);
<span>
<?=
$handler
->
htmlEncode
(
$exception
->
getName
())
?>
</span>
–
if
(
$name
!==
null
)
:
?>
<span>
<?=
$handler
->
htmlEncode
(
$name
)
?>
</span>
–
<?=
$handler
->
addTypeLinks
(
get_class
(
$exception
))
?>
<?=
$handler
->
addTypeLinks
(
get_class
(
$exception
))
?>
<?php
else
:
?>
<?php
else
:
?>
<span>
<?=
$handler
->
htmlEncode
(
get_class
(
$exception
))
?>
</span>
<span>
<?=
$handler
->
htmlEncode
(
get_class
(
$exception
))
?>
</span>
...
...
framework/web/ErrorHandler.php
View file @
340278b5
...
@@ -379,4 +379,17 @@ class ErrorHandler extends \yii\base\ErrorHandler
...
@@ -379,4 +379,17 @@ class ErrorHandler extends \yii\base\ErrorHandler
return
$out
;
return
$out
;
}
}
/**
* Returns human-readable exception name
* @param \Exception $exception
* @return string human-readable exception name or null if it cannot be determined
*/
public
function
getExceptionName
(
$exception
)
{
if
(
$exception
instanceof
\yii\base\Exception
||
$exception
instanceof
\yii\base\InvalidCallException
||
$exception
instanceof
\yii\base\InvalidParamException
||
$exception
instanceof
\yii\base\UnknownMethodException
)
{
return
$exception
->
getName
();
}
return
null
;
}
}
}
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