/api/paper-by-id returns 500 instead of 404 for a paper that doesn't exist
Maintainer thường phản hồi trong vòng 4 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- typescript
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Read src/lib/services/paper.ts at the linked getPaperById code and inspect the /api/paper-by-id route plus @/lib/utils/error for the existing error handling pattern. Verify the behavior for a valid ObjectId with no matching paper; done means the endpoint returns 404 with “Paper not found” and the paper page can distinguish that from a server error. Pull request #561 is already open for this issue.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
getPaperById throws a plain Error("Paper not found") (with a // 404 comment) and the route catches every error and returns 500 "Failed to fetch paper"
To Reproduce
- Request
/api/paper-by-id/<a valid ObjectId that isn't in the database>, e.g./api/paper-by-id/000000000000000000000000 - The response is 500 "Failed to fetch paper"
Expected behavior
404 "Paper not found". CustomError and customErrorHandler from @/lib/utils/error (added in #436) already do this. Throwing new CustomError("Paper not found", 404) and using customErrorHandler in the route would fix it and the paper page could then tell "not found" apart from a server error
- Ngôn ngữ chính
- TypeScript
- Star
- 23
- Fork
- 67
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của CodeChefVIT/papers-codechef
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
CodeChefVIT/papers-codechef#577 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
CodeChefVIT/papers-codechef#552 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 4 ngày
-
/api/upcoming-papers Throws 404 When No Exams are ActiveCó thể đã có người làm @Dx-Alz-xD đã nhận 16 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
CodeChefVIT/papers-codechef#549 · 1 reaction ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 69/100
CodeChefVIT/papers-codechef#576 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 64/100
CodeChefVIT/papers-codechef#575 ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của CodeChefVIT/papers-codechef
Issue tương tự
-
good first issue help wanted
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 86/100
Intelligenza-Umana/intelligenza-umana-web#16 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
open-webui/open-webui#35184 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
danielmiessler/LifeOS#3001 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày