andrewdyer / andrewdyer/slim-api-template

Custom exception handling for proper REST status codes

オープン
#16 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
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 はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。