3 namespace BookStack\Exceptions;
5 use Whoops\Handler\Handler;
7 class WhoopsBookStackPrettyHandler extends Handler
11 * @return int|null A handler may return nothing, or a Handler::HANDLE_* constant
13 public function handle()
15 $exception = $this->getException();
17 echo view('errors.debug', [
18 'error' => $exception->getMessage(),
19 'errorClass' => get_class($exception),
20 'trace' => $exception->getTraceAsString(),
21 'environment' => $this->getEnvironment(),
27 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');
41 return trim(file_get_contents($versionFile));
43 'Theme Configured' => $this->safeReturn(function() {
44 return config('view.theme');