3 namespace BookStack\Exceptions;
6 use Illuminate\Http\JsonResponse;
8 class JsonDebugException extends Exception
10 protected array $data;
13 * JsonDebugException constructor.
15 public function __construct(array $data)
18 parent::__construct();
22 * Convert this exception into a response.
23 * We add a manual data conversion to UTF8 to ensure any binary data is presentable as a JSON string.
25 public function render(): JsonResponse
27 $cleaned = mb_convert_encoding($this->data, 'UTF-8');
29 return response()->json($cleaned);