Fix error views on app bootstrap

This commit is contained in:
Giuseppe Criscione 2024-05-20 00:15:37 +02:00
parent e9b14b8439
commit fd7b9bc218
3 changed files with 21 additions and 21 deletions

View File

@ -2,4 +2,7 @@
<h2>Oops, something went wrong!</h2>
<p>Formwork encountered an error while serving your request.<br>If you are the maintainer of this site, please check Formwork configuration or the server log for errors.</p>
<p><a href="https://github.com/getformwork/formwork/issues" target="_blank">Report an issue to GitHub</a></p>
<?php if ($throwable && $app->config()->get('system.debug.enabled', false)) : ?>
<?php $this->insert('errors.partials.debug') ?>
<?php endif ?>
<?php $this->insert('errors.partials.footer') ?>

View File

@ -1,17 +1,15 @@
<?php if ($app->config()->get('system.debug.enabled', false) && $throwable) : ?>
<div class="error-debug-details">
<h3>Uncaught <code><?= $throwable::class ?></code>: <?= $throwable->getMessage() ?></h3>
<details open>
<summary><a class="error-debug-editor-uri" href="<?= Formwork\Utils\Str::interpolate($app->config()->get('system.debug.editorUri'), ['filename' => $throwable->getFile(), 'line' => $throwable->getLine()]) ?>"><span class="error-debug-filename"><?= preg_replace('/([^\/]+)$/', '<strong>$1</strong>', $throwable->getFile()) ?></span><span class="error-debug-line">:<?= $throwable->getLine() ?></span></a></summary>
<?= Formwork\Utils\CodeDumper::dumpLine($throwable->getFile(), $throwable->getLine(), $app->config()->get('system.debug.contextLines', 5)) ?>
</details>
<?php foreach ($throwable->getTrace() as $trace) : ?>
<?php if (isset($trace['file'], $trace['line']) && $trace['file'] !== $throwable->getFile() && $trace['line'] !== $throwable->getLine()) : ?>
<details>
<summary><a class="error-debug-editor-uri" href="<?= Formwork\Utils\Str::interpolate($app->config()->get('system.debug.editorUri'), ['filename' => $trace['file'], 'line' => $trace['line']]) ?>"><span class="error-debug-filename"><?= preg_replace('/([^\/]+)$/', '<strong>$1</strong>', $trace['file']) ?></span><span class="error-debug-line">:<?= $trace['line'] ?></span></a></summary>
<?= Formwork\Utils\CodeDumper::dumpLine($trace['file'], $trace['line'], $app->config()->get('system.debug.contextLines', 5)) ?>
</details>
<?php endif ?>
<?php endforeach ?>
</div>
<?php endif ?>
</div>
<div class="error-debug-details">
<h3>Uncaught <code><?= $throwable::class ?></code>: <?= $throwable->getMessage() ?></h3>
<details open>
<summary><a class="error-debug-editor-uri" href="<?= Formwork\Utils\Str::interpolate($app->config()->get('system.debug.editorUri'), ['filename' => $throwable->getFile(), 'line' => $throwable->getLine()]) ?>"><span class="error-debug-filename"><?= preg_replace('/([^\/]+)$/', '<strong>$1</strong>', $throwable->getFile()) ?></span><span class="error-debug-line">:<?= $throwable->getLine() ?></span></a></summary>
<?= Formwork\Utils\CodeDumper::dumpLine($throwable->getFile(), $throwable->getLine(), $app->config()->get('system.debug.contextLines', 5)) ?>
</details>
<?php foreach ($throwable->getTrace() as $trace) : ?>
<?php if (isset($trace['file'], $trace['line']) && $trace['file'] !== $throwable->getFile() && $trace['line'] !== $throwable->getLine()) : ?>
<details>
<summary><a class="error-debug-editor-uri" href="<?= Formwork\Utils\Str::interpolate($app->config()->get('system.debug.editorUri'), ['filename' => $trace['file'], 'line' => $trace['line']]) ?>"><span class="error-debug-filename"><?= preg_replace('/([^\/]+)$/', '<strong>$1</strong>', $trace['file']) ?></span><span class="error-debug-line">:<?= $trace['line'] ?></span></a></summary>
<?= Formwork\Utils\CodeDumper::dumpLine($trace['file'], $trace['line'], $app->config()->get('system.debug.contextLines', 5)) ?>
</details>
<?php endif ?>
<?php endforeach ?>

View File

@ -1,5 +1,4 @@
</div>
<?php $this->insert('errors.partials.debug') ?>
</body>
</div>
</body>
</html>
</html>