feat(exceptions): add NotFoundException for entity handling

Introduces a NotFoundException to standardize error handling for missing entities.
This commit is contained in:
Jérémy Munsch 2026-08-13 16:24:08 +02:00
parent 61bde4baaa
commit 6ba04fe009
Signed by: forge-joniko
GPG key ID: D7EFE2F5CB6CC0E4
7 changed files with 8 additions and 8 deletions

View file

@ -2,9 +2,9 @@
declare(strict_types=1);
namespace Domain\Exceptions;
namespace Application\Exceptions;
final class NotFoundException extends \DomainException
final class NotFoundException extends \RuntimeException
{
public static function forEntity(string $entity, string $id): self
{

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Application\Usecase\Employees\Find;
use Domain\Exceptions\NotFoundException;
use Application\Exceptions\NotFoundException;
use Domain\Ports\Directories\EmployeeDirectory;
use Shared\DDD\Usecase\Input as BaseInput;
use Shared\DDD\Usecase\Usecase;

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Presentation\Api\V1\Exceptions;
use Domain\Exceptions\NotFoundException;
use Application\Exceptions\NotFoundException;
use Illuminate\Http\Exceptions\ThrottleRequestsException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Presentation\Web\Exceptions;
use Domain\Exceptions\NotFoundException;
use Application\Exceptions\NotFoundException;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
use Throwable;

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Tests\Integration\Presentation\Api;
use Domain\Exceptions\NotFoundException;
use Application\Exceptions\NotFoundException;
use Illuminate\Http\Request;
use Presentation\Api\Exceptions\ApiExceptionDispatcher;
use Presentation\Api\V1\Exceptions\ApiExceptionRenderer as V1ApiExceptionRenderer;

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Tests\Integration\Presentation\Api\V1;
use Domain\Exceptions\NotFoundException;
use Application\Exceptions\NotFoundException;
use Illuminate\Http\Exceptions\ThrottleRequestsException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Config;

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Tests\Integration\Presentation\Web;
use Domain\Exceptions\NotFoundException;
use Application\Exceptions\NotFoundException;
use Illuminate\Http\Request;
use Presentation\Web\Exceptions\WebExceptionRenderer;