]> BookStack Code Mirror - bookstack/blobdiff - app/Exceptions/WhoopsBookStackPrettyHandler.php
Added additional testing for editor switching permissions
[bookstack] / app / Exceptions / WhoopsBookStackPrettyHandler.php
index 4e92b1d84057d69fe12ef40c3dc0618de615a86e..dcf50fa8e465e07d36180bfb38b42028402c97e2 100644 (file)
@@ -6,28 +6,25 @@ use Whoops\Handler\Handler;
 
 class WhoopsBookStackPrettyHandler extends Handler
 {
-
     /**
      * @return int|null A handler may return nothing, or a Handler::HANDLE_* constant
      */
     public function handle()
     {
-        // TODO - Assistance View
-        // Docs links
-        // Discord Links
-        // Github Issue Links (With pre-filled search?)
-
         $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) {
@@ -38,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
+}