<?php

namespace App\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

class Handler extends ExceptionHandler
{
    protected $dontReport = [];

    protected $dontFlash = [
        'current_password',
        'password',
        'password_confirmation',
    ];

    public function register(): void
    {
        //
    }

    public function render($request, Throwable $exception)
    {
        // Handle all 404 errors (routes + abort(404))
        if ($exception instanceof NotFoundHttpException) {
            return response()->view('livewire.common.not-found', [], 404);
        }

        return parent::render($request, $exception);
    }
}
