Skip to content

Conversation

iNeoO
Copy link

@iNeoO iNeoO commented Oct 14, 2025

fix wrong class error call

btw, using

if(code === "NOT_FOUND")

cause an error

ReferenceError: _r_r is not defined
    at he.eval [as handleError] (eval at vn (https://esm.sh/[email protected]/es2022/elysia.mjs:338:104), <anonymous>:14:44)
    at map (eval at Zt (https://esm.sh/[email protected]/es2022/elysia.mjs:308:43), <anonymous>:35:12)
    at he.fetch (https://esm.sh/[email protected]/es2022/elysia.mjs:349:12354)
    at he.handle (https://esm.sh/[email protected]/es2022/elysia.mjs:349:12285)
    at self.onmessage (blob:https://elysiajs.com/3c40943f-9e0a-4365-90db-487686878d7e:89:32)
    ```

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Documentation**
  * Updated the error-handling tutorial for consistency, using a single custom error type across route examples and onError handling.
  * Clarified code samples to better illustrate error-code-based type narrowing.
  * No functional or API changes; this is a content improvement to align examples and improve clarity.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

fix wrong class error call
Copy link

coderabbitai bot commented Oct 14, 2025

Walkthrough

In the error-handling tutorial, the thrown error type in a route example is updated from CustomError to NicheError, aligning with the surrounding custom error example and its onError handling and type narrowing. No functional logic or control-flow changes are introduced.

Changes

Cohort / File(s) Summary
Docs — Error Handling Tutorial
docs/tutorial/patterns/error-handling/index.md
Updated example to throw NicheError instead of CustomError; adjusted accompanying onError handling and error-code-based type narrowing text to match.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A nibble of docs, a hop through the night,
Swapped Custom for Niche—now the samples read right.
With ears up for errors and whiskers in flow,
I bound through the margins where good patterns grow.
Thump-thump! The guide’s tidy—onward we go.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly reflects the main change by stating that the thrown error class is being updated to NicheError in the tutorial’s error-handling section. It is concise, free of file names or extraneous details, and communicates the precise intent of the update. A reviewer scanning the pull request list would immediately understand the correction being made. Thus, it meets the criteria for a clear, specific, and succinct PR title.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cdac872 and b49723a.

📒 Files selected for processing (1)
  • docs/tutorial/patterns/error-handling/index.md (1 hunks)
🔇 Additional comments (1)
docs/tutorial/patterns/error-handling/index.md (1)

81-81: Aligning the thrown error with NicheError fixes the mismatch.

Switching the thrown instance to NicheError keeps the example consistent with the .error registration, so the type narrowing and runtime behavior now line up. Nice catch.


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

@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 3d2186d and cdac872.

📒 Files selected for processing (1)
  • docs/tutorial/patterns/error-handling/index.md (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
docs/tutorial/patterns/error-handling/index.md

81-81: Hard tabs
Column: 1

(MD010, no-hard-tabs)

@iNeoO iNeoO changed the title Update index.md Fix thrown error class to NicheError in error-handling tutorial, Oct 14, 2025
change tab to space
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