X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/ffa4377e65d8ea7342ea669f47a6d538d0c69194..refs/pull/3630/head:/app/Exceptions/WhoopsBookStackPrettyHandler.php diff --git a/app/Exceptions/WhoopsBookStackPrettyHandler.php b/app/Exceptions/WhoopsBookStackPrettyHandler.php index 22a49e04a..dcf50fa8e 100644 --- a/app/Exceptions/WhoopsBookStackPrettyHandler.php +++ b/app/Exceptions/WhoopsBookStackPrettyHandler.php @@ -6,7 +6,6 @@ use Whoops\Handler\Handler; class WhoopsBookStackPrettyHandler extends Handler { - /** * @return int|null A handler may return nothing, or a Handler::HANDLE_* constant */ @@ -15,16 +14,17 @@ class WhoopsBookStackPrettyHandler extends Handler $exception = $this->getException(); echo view('errors.debug', [ - 'error' => $exception->getMessage(), - 'errorClass' => get_class($exception), - 'trace' => $exception->getTraceAsString(), + 'error' => $exception->getMessage(), + 'errorClass' => get_class($exception), + 'trace' => $exception->getTraceAsString(), 'environment' => $this->getEnvironment(), ])->render(); return Handler::QUIT; } - protected function safeReturn(callable $callback, $default = null) { + protected function safeReturn(callable $callback, $default = null) + { try { return $callback(); } catch (\Exception $e) { @@ -35,14 +35,15 @@ class WhoopsBookStackPrettyHandler extends Handler protected function getEnvironment(): array { return [ - 'PHP Version' => phpversion(), - 'BookStack Version' => $this->safeReturn(function() { + 'PHP Version' => phpversion(), + 'BookStack Version' => $this->safeReturn(function () { $versionFile = base_path('version'); + return trim(file_get_contents($versionFile)); }, 'unknown'), - 'Theme Configured' => $this->safeReturn(function() { - return config('view.theme'); - }) ?? 'None', + 'Theme Configured' => $this->safeReturn(function () { + return config('view.theme'); + }) ?? 'None', ]; } -} \ No newline at end of file +}