mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-27 20:40:22 +08:00
PHP supports exception stacks since 5.3 so we should use it. Also Errorhandler is now able to display the stack: #297
20 lines
827 B
PHP
20 lines
827 B
PHP
<div class="previous">
|
|
<h1><span class="arrow">↵</span><span>Caused by: </span><?php
|
|
/**
|
|
* @var \yii\base\View $this
|
|
* @var \yii\base\Exception $exception
|
|
* @var string $previousHtml
|
|
* @var \yii\base\ErrorHandler $context
|
|
*/
|
|
$context = $this->context;
|
|
if ($exception instanceof \yii\base\Exception) {
|
|
echo '<span>' . $context->htmlEncode($exception->getName()) . '</span>';
|
|
echo ' – ' . $context->addTypeLinks(get_class($exception));
|
|
} else {
|
|
echo '<span>' . $context->htmlEncode(get_class($exception)) . '</span>';
|
|
}
|
|
?></h1>
|
|
<h2><?php echo $context->htmlEncode($exception->getMessage()); ?></h2>
|
|
<p>In <span class="file"><?php echo $exception->getFile(); ?></span> at line <span class="line"><?php echo $exception->getLine(); ?></span></p>
|
|
<?php echo $previousHtml; ?>
|
|
</div>
|