vrry
7 months ago

Catch NotFoundHttpException

Posted 7 months ago by vrry

[#ASK]

I want to use my handler NotFoundHttpException exception in App\Exceptions\Handler.php. But I get this message.

{ "status": "error", "message": "Endpoint is not found", "data": null, "errors": { "exception": "Symfony\Component\HttpKernel\Exception\NotFoundHttpException", "trace": [ "#0 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Routing\Router.php(636): Illuminate\Routing\RouteCollection->match(Object(Illuminate\Http\Request))", "#1 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Routing\Router.php(625): Illuminate\Routing\Router->findRoute(Object(Illuminate\Http\Request))", "#2 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Routing\Router.php(614): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))", "#3 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))", "#4 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))", "#5 C:\laragon\www\larashop\vendor\fideloper\proxy\src\TrustProxies.php(57): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))", "#6 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(151): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))", "#7 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))", "#8 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(31): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))", "#9 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(151): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))", "#10 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))", "#11 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(31): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))", "#12 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(151): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))", "#13 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))", "#14 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))", "#15 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(151): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))", "#16 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))", "#17 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php(62): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))", "#18 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(151): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))", "#19 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))", "#20 C:\laragon\www\larashop\vendor\barryvdh\laravel-cors\src\HandlePreflight.php(29): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))", "#21 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(151): Barryvdh\Cors\HandlePreflight->handle(Object(Illuminate\Http\Request), Object(Closure))", "#22 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))", "#23 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))", "#24 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))", "#25 C:\laragon\www\larashop\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))", "#26 C:\laragon\www\larashop\public\index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))", "#27 {main}" ] } }

I already 'use' this Symfony\Component\HttpKernel\Exception\NotFoundHttpException; in Handler.php class. Thanks before

Please sign in or create an account to participate in this conversation.