Merge pull request #2732 from Wv5twkFEKh54vo4tta9yu7dHa3/staging

Use same json error format as Mastodon
This commit is contained in:
daniel 2021-04-29 23:43:42 -06:00 committed by GitHub
commit bd27ecb68e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,6 +48,11 @@ class Handler extends ExceptionHandler
*/
public function render($request, Throwable $exception)
{
if ($request->wantsJson())
return response()->json(
['error' => $exception->getMessage()],
method_exists($exception, 'getStatusCode') ? $exception->getStatusCode() : 500
);
return parent::render($request, $exception);
}
}