Feat implement centralized error handling for API routes#474
Feat implement centralized error handling for API routes#474Aryanshravan wants to merge 1 commit into
Conversation
|
@Aryanshravan is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel. A member of the Team first needs to authorize it. |
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
There was a problem hiding this comment.
Thanks for your first PR on DevTrack! 🎉
A maintainer will review it within 48 hours. While you wait:
- Make sure CI is passing (type-check + lint)
- Double-check the PR description is filled out and the issue is linked
- Feel free to ask questions in Discussions if you need help
If you find DevTrack useful, a ⭐ star on the repo is always appreciated — it helps the project grow and attract more contributors!
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
Three issues:
-
Remove
CODEBASE_ISSUES.md— an AI-generated 708-line analysis dump doesn't belong in the repo. This file alone blocks merge. -
handleAPIErrorandcreateErrorResponseare dead code — exported fromerror-handler.tsbut never called in the changed routes (which calllogErrordirectly). Either use them or remove them from the PR scope. -
logErrorexposes raw stack traces in production —console.error(JSON.stringify(logEntry))includeserrorandstackfields unconditionally. Gate stack traces behindprocess.env.NODE_ENV !== 'production'to avoid leaking internals (same pattern PR #472 just fixed in the error boundary).
Summary
Implements centralized error handling across API routes to improve debugging and error tracking consistency.
Closes #470
Type of Change
Changes Made
src/lib/error-handler.tswith centralized error logging utilitieslogError()- Logs errors with timestamp, endpoint, operation, and contextcreateErrorResponse()- Standardized error response formathandleAPIError()- Helper function for consistent error handlingsrc/app/api/badge/commits/route.tssrc/app/api/badge/streak-shield/route.tssrc/app/api/webhooks/github/route.tsHow to Test
/api/badge/commitswithoutuserparam)Checklist
npm run lintpasses locallynpm run type-check)