Fix DatabaseSeeder fetch key array issue and add exception details dump to 500 error page
This commit is contained in:
@@ -113,6 +113,7 @@ class App
|
||||
if (file_exists($viewPath)) {
|
||||
ob_start();
|
||||
$message = $e->getMessage();
|
||||
$exception = $e;
|
||||
include $viewPath;
|
||||
$content = ob_get_clean();
|
||||
$this->response->html($content, $code);
|
||||
|
||||
@@ -64,8 +64,8 @@ class DatabaseSeeder
|
||||
}
|
||||
|
||||
// Fetch Role IDs and Permission IDs
|
||||
$roleIds = $this->pdo->query("SELECT id, code FROM roles")->fetchAll(PDO::FETCH_KEY_PAIR);
|
||||
$permissionIds = $this->pdo->query("SELECT id, code FROM permissions")->fetchAll(PDO::FETCH_KEY_PAIR);
|
||||
$roleIds = $this->pdo->query("SELECT code, id FROM roles")->fetchAll(PDO::FETCH_KEY_PAIR);
|
||||
$permissionIds = $this->pdo->query("SELECT code, id FROM permissions")->fetchAll(PDO::FETCH_KEY_PAIR);
|
||||
|
||||
// Map Permissions to Admin (All permissions)
|
||||
foreach ($permissionIds as $pId => $pCode) {
|
||||
|
||||
@@ -11,6 +11,14 @@
|
||||
<span style="font-size: 5rem; font-weight: 800; background: var(--primary-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-family: 'Outfit';">500</span>
|
||||
<h1 style="font-size: 1.8rem; font-weight: 700;">System Server Error</h1>
|
||||
<p style="color: var(--text-muted); font-size: 1rem; line-height: 1.6;"><?= isset($message) ? $this->escape($message) : 'A critical exception has occurred on the application server.' ?></p>
|
||||
<?php if (filter_var($_ENV['APP_DEBUG'] ?? false, FILTER_VALIDATE_BOOLEAN) && isset($exception)): ?>
|
||||
<pre style="text-align: left; background: rgba(0,0,0,0.5); padding: 15px; border-radius: 8px; overflow-x: auto; font-family: monospace; font-size: 0.85rem; color: #ff6b6b; max-height: 250px; margin-top: 15px;">
|
||||
<?= $this->escape($exception->getMessage()) ?>
|
||||
in <?= $this->escape($exception->getFile()) ?>:<?= $exception->getLine() ?>
|
||||
|
||||
<?= $this->escape($exception->getTraceAsString()) ?>
|
||||
</pre>
|
||||
<?php endif; ?>
|
||||
<a href="/" class="btn btn-primary" style="align-self: center;">Return Home</a>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user