mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-26 09:46:49 +00:00
Merge pull request #2732 from Wv5twkFEKh54vo4tta9yu7dHa3/staging
Use same json error format as Mastodon
This commit is contained in:
commit
bd27ecb68e
1 changed files with 5 additions and 0 deletions
|
@ -48,6 +48,11 @@ class Handler extends ExceptionHandler
|
||||||
*/
|
*/
|
||||||
public function render($request, Throwable $exception)
|
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);
|
return parent::render($request, $exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue