ldc-arcadia-api/src/Presentation/Api/V1/Exceptions/ApiErrorCode.php
Jérémy Munsch a93fde3a3c
feat(api): implement rate limiting and error handling
- Added rate limiting for web and API requests.
- Introduced custom error handling for "Too Many Requests" response.
- Created view for "Too Many Requests" error documentation.
2026-08-12 17:25:45 +02:00

30 lines
791 B
PHP

<?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 TooManyRequests = 'too-many-requests';
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::TooManyRequests => 'Too Many Requests',
self::InternalError => 'Internal Server Error',
};
}
}