How Laravel Handles HTTP Errors
A request hits a non-existent route
Router throws NotFoundHttpException
Exception is caught by Handler
Laravel looks for resources/views/errors/404.blade.php (example)
Returns an HTTP 404 response with the rendered view
Common Handling
app/Exceptions/Handler.php : converts exceptions into HTTP responses.
<?php
namespace App\Exceptions ;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler ; use Illuminate\Http\Exceptions\ThrottleRequestsException ; use Illuminate\Session\TokenMismatchException ; use Illuminate\Auth\Access\AuthorizationException ; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException ; use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException ; use Throwable ;
class Handler extends ExceptionHandler { /** * The list of the inputs that are never flashed to the session on validation exceptions.…