diff --git a/items/api/app/Exceptions/Handler.php b/items/api/app/Exceptions/Handler.php index b375c61..8d36be8 100644 --- a/items/api/app/Exceptions/Handler.php +++ b/items/api/app/Exceptions/Handler.php @@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Validation\ValidationException; use Laravel\Lumen\Exceptions\Handler as ExceptionHandler; use Symfony\Component\HttpKernel\Exception\HttpException; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Throwable; class Handler extends ExceptionHandler @@ -49,6 +50,9 @@ class Handler extends ExceptionHandler */ public function render($request, Throwable $exception) { + if ($exception instanceof NotFoundHttpException) { + return redirect('/search'); + } return parent::render($request, $exception); } }