Skip to content

Conversation

@braden-w
Copy link

@braden-w braden-w commented Dec 5, 2025

This adds JSDoc documentation to the status() function in src/error.ts with examples showing both usage patterns: numeric codes (like 418) and string status names (like "I'm a teapot"). The string syntax provides TypeScript autocompletion for all valid HTTP status names, which is a nice DX improvement worth surfacing to developers.

// Both of these work identically:
status(418, 'I am a teapot')
status("I'm a teapot", 'I am a teapot')

// Without response body (defaults to status message)
status(204)
status("No Content")

Summary by CodeRabbit

  • New Features
    • Added a new status() helper function for creating status responses with flexible input options (numeric or named codes), automatic type inference, and enhanced autocompletion support.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 5, 2025

Warning

Rate limit exceeded

@braden-w has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 59 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 786b9d5 and c111652.

📒 Files selected for processing (1)
  • src/error.ts (1 hunks)

Walkthrough

A new status helper function is added to src/error.ts that constructs and returns an ElysiaCustomStatusResponse, accepting HTTP status codes as numbers or named keys with optional response bodies and full type inference.

Changes

Cohort / File(s) Summary
Status Helper Function
src/error.ts
Added status(code, response?) public API function that wraps ElysiaCustomStatusResponse constructor, supporting both numeric and named HTTP status codes with typed response bodies and automatic status message defaults

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Single file modification with straightforward utility function addition
  • No complex logic or control flow changes to evaluate
  • Primarily a convenience wrapper around existing error handling infrastructure

Poem

A helper hopped into the file,
With status codes wearing a smile,
Now responses align,
With types so divine,
HTTP replies compiled in style! 🐰✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main change: adding JSDoc documentation to the status() function that explains both string and number argument support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 07b449a and 786b9d5.

📒 Files selected for processing (1)
  • src/error.ts (1 hunks)

Document that numeric codes in emptyHttpStatus (101, 204, 205, 304, 307, 308)
always omit the response body, while string status names bypass this check.

Update examples to show:
- status(204) yields undefined (no body)
- status("No Content") yields "No Content" string body
- status(404) defaults to "Not Found" body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant