Skip to content

Commit

Permalink
BlueScreen: previous exception messages are formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Feb 3, 2021
1 parent dbbcd39 commit aff47f2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/Tracy/BlueScreen/BlueScreen.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ public function renderToFile(\Throwable $exception, string $file): bool
private function renderTemplate(\Throwable $exception, string $template, $toScreen = true): void
{
$showEnvironment = $this->showEnvironment && (strpos($exception->getMessage(), 'Allowed memory size') === false);
$messageHtml = $this->formatMessage($exception);
$info = array_filter($this->info);
$source = Helpers::getSource();
$title = $exception instanceof \ErrorException
Expand Down Expand Up @@ -370,7 +369,7 @@ public function getDumper(): \Closure
}


private function formatMessage(\Throwable $exception): string
public function formatMessage(\Throwable $exception): string
{
$msg = Helpers::encodeString(trim((string) $exception->getMessage()), self::MAX_MESSAGE_LENGTH);

Expand Down
5 changes: 2 additions & 3 deletions src/Tracy/BlueScreen/assets/content.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
*
* @param array $exception
* @param string $messageHtml
* @param array[] $actions
* @param array $info
* @param string $title
Expand All @@ -32,7 +31,7 @@ $code = $exception->getCode() ? ' #' . $exception->getCode() : '';
<?php if ($exception->getMessage()): ?><p><?= Helpers::encodeString($title . $code, self::MAX_MESSAGE_LENGTH) ?></p><?php endif ?>


<h1><span><?= $messageHtml ?: Helpers::encodeString($title . $code, self::MAX_MESSAGE_LENGTH) ?></span>
<h1><span><?= $this->formatMessage($exception) ?></span>
<?php foreach ($actions as $item): ?>
<a href="<?= Helpers::escapeHtml($item['link']) ?>" class="action"<?= empty($item['external']) ? '' : ' target="_blank" rel="noreferrer noopener"'?>><?= Helpers::escapeHtml($item['label']) ?>&#x25ba;</a>
<?php endforeach ?></h1>
Expand All @@ -56,7 +55,7 @@ $code = $exception->getCode() ? ' #' . $exception->getCode() : '';
<div class="panel">
<h2><?= Helpers::escapeHtml(Helpers::getClass($ex) . ($ex->getCode() ? ' #' . $ex->getCode() : '')) ?></h2>

<h2><?= Helpers::escapeHtml($ex->getMessage()) ?></h2>
<h2><?= $this->formatMessage($ex) ?></h2>
</div>
<?php endif ?>

Expand Down

0 comments on commit aff47f2

Please sign in to comment.