diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-11-10 12:18:33 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-11-10 12:35:08 +0300 |
commit | 979b291a36caabd28f21d2d4b10b431f5f8ebdd3 (patch) | |
tree | 3d28eba5b1f5f8f73d1ccb86eb2b82956d3c9c21 /core | |
parent | 78e1f228933ca3b67a628deff532704d6c7caba8 (diff) |
Show the full trace of an exception
Because often we catch the exception at some point and then the trace is
misleading. What's really interesting is the trace of the *previous*
exception.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core')
-rw-r--r-- | core/templates/exception.php | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/core/templates/exception.php b/core/templates/exception.php index 9fd19d5a8b1..c8a26220092 100644 --- a/core/templates/exception.php +++ b/core/templates/exception.php @@ -1,8 +1,24 @@ <?php - /** @var array $_ */ - /** @var \OCP\IL10N $l */ +/** @var array $_ */ +/** @var \OCP\IL10N $l */ style('core', ['styles', 'header']); + +function print_exception(Throwable $e, \OCP\IL10N $l): void { + print_unescaped('<pre>'); + p($e->getTraceAsString()); + print_unescaped('</pre>'); + + if ($e->getPrevious() !== null) { + print_unescaped('<br />'); + print_unescaped('<h4>'); + p($l->t('Previous')); + print_unescaped('</h4>'); + + print_exception($e->getPrevious(), $l); + } +} + ?> <div class="error error-wide"> <h2><?php p($l->t('Internal Server Error')) ?></h2> @@ -26,6 +42,6 @@ style('core', ['styles', 'header']); <?php if (isset($_['debugMode']) && $_['debugMode'] === true): ?> <br /> <h3><?php p($l->t('Trace')) ?></h3> - <pre><?php p($_['trace']) ?></pre> + <?php print_exception($_['exception'], $l); ?> <?php endif; ?> </div> |