Commit 7511de6c by Carsten Brandt

added errorInfo to exception views

parent a2aa20f1
......@@ -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\nin " . 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();
}
......
......@@ -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: -5px;
margin-left: -25px;
margin-top: -3px;
margin-left: -30px;
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>
......
......@@ -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>
......@@ -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>';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment