3 namespace BookStack\Exceptions;
5 use Whoops\Handler\Handler;
7 class WhoopsBookStackPrettyHandler extends Handler
10 * @return int|null A handler may return nothing, or a Handler::HANDLE_* constant
12 public function handle()
14 $exception = $this->getException();
16 echo view('errors.debug', [
17 'error' => $exception->getMessage(),
18 'errorClass' => get_class($exception),
19 'trace' => $exception->getTraceAsString(),
20 'environment' => $this->getEnvironment(),
26 protected function safeReturn(callable $callback, $default = null)
30 } catch (\Exception $e) {
35 protected function getEnvironment(): array
38 'PHP Version' => phpversion(),
39 'BookStack Version' => $this->safeReturn(function () {
40 $versionFile = base_path('version');
42 return trim(file_get_contents($versionFile));
44 'Theme Configured' => $this->safeReturn(function () {
45 return config('view.theme');