]> BookStack Code Mirror - bookstack/blob - app/Exceptions/JsonDebugException.php
Added testing for our request method overrides
[bookstack] / app / Exceptions / JsonDebugException.php
1 <?php
2
3 namespace BookStack\Exceptions;
4
5 use Exception;
6 use Illuminate\Http\JsonResponse;
7
8 class JsonDebugException extends Exception
9 {
10     protected array $data;
11
12     /**
13      * JsonDebugException constructor.
14      */
15     public function __construct(array $data)
16     {
17         $this->data = $data;
18         parent::__construct();
19     }
20
21     /**
22      * Covert this exception into a response.
23      */
24     public function render(): JsonResponse
25     {
26         return response()->json($this->data);
27     }
28 }