Skip to content

feat: add structured error responses with error classes and handler tests#449

Merged
PRODHOSH merged 1 commit into
PRODHOSH:mainfrom
DebasmitaBose0:feat/421-error-handler-tests
Jul 14, 2026
Merged

feat: add structured error responses with error classes and handler tests#449
PRODHOSH merged 1 commit into
PRODHOSH:mainfrom
DebasmitaBose0:feat/421-error-handler-tests

Conversation

@DebasmitaBose0

@DebasmitaBose0 DebasmitaBose0 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Clsoes #421

Summary

Adds structured error responses with typed error classes, standardized error body format, and e2e tests for error shapes.

Changes

  • src/lib/errors.ts — new: AppError, ValidationError, AuthError, NotFoundError, RateLimitError, UpstreamError classes; toApiErrorBody() for standardized shape ({ error, code, status, timestamp })
  • src/lib/validators/api.tscreateErrorResponse now emits { error, code, status, timestamp }; added apiErrorResponse() for AppError instances; added errorCodeForStatus() mapping
  • e2e/error-handling.spec.ts — tests for 400/404/429 error shapes, retryAfterSeconds, timestamp format

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@DebasmitaBose0, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 45 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0c947799-07eb-46a7-a5c5-cfe6175aa285

📥 Commits

Reviewing files that changed from the base of the PR and between 294511e and a0c0237.

📒 Files selected for processing (3)
  • e2e/error-handling.spec.ts
  • src/lib/errors.ts
  • src/lib/validators/api.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Welcome to OSSfolio, @DebasmitaBose0! 🎉

Thank you for opening this pull request and contributing to the open-source community! 🚀

To ensure a smooth review process, please make sure you have:

  • Checked that your changes work locally and compile cleanly.
  • Followed the guidelines outlined in CONTRIBUTING.md.
  • Linked your PR to an open issue (e.g. Closes #ISSUE_NUMBER).

We will review your PR as soon as possible. Happy coding! 💻✨

@github-actions github-actions Bot added the backend Supabase / API / database label Jul 13, 2026
@PRODHOSH PRODHOSH self-requested a review July 14, 2026 03:08
@PRODHOSH PRODHOSH added enhancement New feature or improvement ELUSOC ELUSOC project submission completed ADVENTURER Intermediate — 25 pts labels Jul 14, 2026
@PRODHOSH PRODHOSH merged commit e877538 into PRODHOSH:main Jul 14, 2026
6 of 10 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Your PR just got merged, @DebasmitaBose0 — thank you for contributing to OSSfolio!

Your work is now part of the project. Here's what to do next:

  • ⭐ If you haven't already, consider giving the repo a star — it helps us grow.
  • 📢 Share your contribution on LinkedIn, Twitter, or wherever you hang out. You shipped open source!
  • 🔍 Browse other open issues if you want to keep contributing.

We really appreciate you taking the time. See you in the next PR! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ADVENTURER Intermediate — 25 pts backend Supabase / API / database completed ELUSOC ELUSOC project submission enhancement New feature or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants