2021-06-26 11:23:15 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace BookStack\Exceptions;
|
2019-11-17 08:26:43 -05:00
|
|
|
|
|
|
|
use Exception;
|
2022-02-24 09:16:09 -05:00
|
|
|
use Illuminate\Http\JsonResponse;
|
2019-11-17 08:26:43 -05:00
|
|
|
|
|
|
|
class JsonDebugException extends Exception
|
|
|
|
{
|
2022-02-24 09:16:09 -05:00
|
|
|
protected array $data;
|
2019-11-17 08:26:43 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* JsonDebugException constructor.
|
|
|
|
*/
|
2022-02-24 09:16:09 -05:00
|
|
|
public function __construct(array $data)
|
2019-11-17 08:26:43 -05:00
|
|
|
{
|
|
|
|
$this->data = $data;
|
2022-02-24 09:16:09 -05:00
|
|
|
parent::__construct();
|
2019-11-17 08:26:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Covert this exception into a response.
|
|
|
|
*/
|
2022-02-24 09:16:09 -05:00
|
|
|
public function render(): JsonResponse
|
2019-11-17 08:26:43 -05:00
|
|
|
{
|
|
|
|
return response()->json($this->data);
|
|
|
|
}
|
2021-03-07 17:24:05 -05:00
|
|
|
}
|