Introduces a NotFoundException to standardize error handling for missing entities.
13 lines
268 B
PHP
13 lines
268 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Application\Exceptions;
|
|
|
|
final class NotFoundException extends \RuntimeException
|
|
{
|
|
public static function forEntity(string $entity, string $id): self
|
|
{
|
|
return new self("{$entity} '{$id}' not found.");
|
|
}
|
|
}
|