mirror of
https://github.com/flarum/framework.git
synced 2024-11-27 02:53:37 +08:00
#1607: Show more details when catching boot errors
This commit is contained in:
parent
430ddefb42
commit
3feca515c3
|
@ -56,7 +56,24 @@ class Server
|
|||
try {
|
||||
return $this->site->bootApp();
|
||||
} catch (Throwable $e) {
|
||||
exit('Error booting Flarum: '.$e->getMessage());
|
||||
exit($this->formatBootException($e));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the most relevant information about an early exception.
|
||||
*/
|
||||
private function formatBootException(Throwable $error): string
|
||||
{
|
||||
$message = $error->getMessage();
|
||||
$file = $error->getFile();
|
||||
$line = $error->getLine();
|
||||
$type = get_class($error);
|
||||
|
||||
return <<<ERROR
|
||||
Flarum encountered a boot error ($type)<br />
|
||||
<b>$message</b><br />
|
||||
thrown in <b>$file</b> on line <b>$line</b>
|
||||
ERROR;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user