andrewdyer / andrewdyer/slim-api-template
Custom exception handling for proper REST status codes
オープン
- 主要言語
- PHP
- スター
- 0
- フォーク
- 0
- 平均マージ
- 2時間 28分
- マージ済み PR(30日)
- 3
説明
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_
コントリビューションガイド
評価
この issue はまだ評価されていません。