ldc-arcadia-api/src/Presentation/Api/V1/Exceptions/ApiErrorCode.php

29 lines
685 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace Presentation\Api\V1\Exceptions;
use Shared\Enums\BaseEnum;
enum ApiErrorCode: string
{
/** @use BaseEnum<string> */
use BaseEnum;
case NotFound = 'not-found';
case ValidationError = 'validation-error';
case BadRequest = 'bad-request';
case InternalError = 'internal-error';
public function title(): string
{
return match ($this) {
self::NotFound => 'Resource Not Found',
self::ValidationError => 'Unprocessable Entity',
self::BadRequest => 'Bad Request',
self::InternalError => 'Internal Server Error',
};
}
}