andrewdyer / andrewdyer/slim-api-template
Custom exception handling for proper REST status codes
Abierto
- Lenguaje dominante
- PHP
- Estrellas
- 0
- Forks
- 0
- Merge medio
- 2 h 28 min
- PR fusionados (30 d)
- 3
Descripción
With only the default ErrorMiddleware configured, domain/input exceptions (e.g., UserNotFoundException, InvalidArgumentException from DTO parsing) will surface as 500 responses. For a REST API this should normally be translated into 404 (not found) / 400 (bad request) to avoid misclassifying client errors as server errors; consider registering custom exception handlers (or throwing Slim HttpNotFoundException/HttpBadRequestException) so actions return appropriate status codes.
_Originally posted by @Copilot in https://github.com/andrewdyer/slim-app-template/pull/15#discussion_r3008602984_
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.