SearchBoxRepository

This commit is contained in:
xiaomlove
2021-05-20 23:30:34 +08:00
parent 51b3582090
commit 576658cd2c
10 changed files with 156 additions and 25 deletions

View File

@@ -76,15 +76,18 @@ class Handler extends ExceptionHandler
protected function prepareJsonResponse($request, Throwable $e)
{
$data = $request->all();
if (config('app.debug')) {
$httpStatusCode = $this->getHttpStatusCode($e);
if ($httpStatusCode == 200) {
$msg = $e->getMessage() ?: get_class($e);
$data['trace'] = $e->getTraceAsString();
} else {
$msg = 'Server Error';
}
if (config('app.debug')) {
$data['trace'] = $e->getTraceAsString();
}
return new JsonResponse(
fail($msg, $data),
$this->getHttpStatusCode($e),
$httpStatusCode,
$this->isHttpException($e) ? $e->getHeaders() : [],
JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES
);