andrewdyer / andrewdyer/slim-api-template

Custom exception handling for proper REST status codes

Đang mở
#16 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
PHP
Star
0
Fork
0
Merge trung bình
2 giờ 28 phút
Pull request đã merge (30 ngày)
3

Mô tả

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_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.