mirror of
https://github.com/flarum/framework.git
synced 2024-12-01 05:53:45 +08:00
#1607: Show more details when catching boot errors
This commit is contained in:
parent
5d768db6d2
commit
c5e3e26d07
|
@ -54,7 +54,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