]> BookStack Code Mirror - bookstack/commitdiff
Change JsonDebugException to Responsable interface 4318/head
authorThomas Kuschan <redacted>
Wed, 14 Jun 2023 12:30:14 +0000 (14:30 +0200)
committerThomas Kuschan <redacted>
Fri, 16 Jun 2023 07:53:12 +0000 (09:53 +0200)
In all other exceptions, when a Response is supposed to be returned,
the Responsable interface is used instead of render.

app/Exceptions/JsonDebugException.php

index 8acc19778e5dad7a0106edf7f9c4fe28659be52b..1fa52c4a2abf914486690cbc674b83a284258d65 100644 (file)
@@ -4,8 +4,9 @@ namespace BookStack\Exceptions;
 
 use Exception;
 use Illuminate\Http\JsonResponse;
+use Illuminate\Contracts\Support\Responsable;
 
-class JsonDebugException extends Exception
+class JsonDebugException extends Exception implements Responsable
 {
     protected array $data;
 
@@ -22,7 +23,7 @@ class JsonDebugException extends Exception
      * Convert this exception into a response.
      * We add a manual data conversion to UTF8 to ensure any binary data is presentable as a JSON string.
      */
-    public function render(): JsonResponse
+    public function toResponse($request): JsonResponse
     {
         $cleaned = mb_convert_encoding($this->data, 'UTF-8');