mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Show proper 404 page for JSON.
This commit is contained in:
@@ -27,6 +27,7 @@ use Exception;
|
|||||||
use FireflyIII\Jobs\MailError;
|
use FireflyIII\Jobs\MailError;
|
||||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
use Request;
|
use Request;
|
||||||
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Handler
|
* Class Handler
|
||||||
@@ -62,6 +63,10 @@ class Handler extends ExceptionHandler
|
|||||||
*/
|
*/
|
||||||
public function render($request, Exception $exception)
|
public function render($request, Exception $exception)
|
||||||
{
|
{
|
||||||
|
if ($exception instanceof NotFoundHttpException && $request->expectsJson()) {
|
||||||
|
return response()->json(['message' => 'Not found'], 404);
|
||||||
|
}
|
||||||
|
|
||||||
if ($exception instanceof FireflyException || $exception instanceof ErrorException) {
|
if ($exception instanceof FireflyException || $exception instanceof ErrorException) {
|
||||||
$isDebug = env('APP_DEBUG', false);
|
$isDebug = env('APP_DEBUG', false);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user