Skip to content

Provide agent guidance on JSG_TRY vs. js.tryCatch - #7067

Open
jasnell wants to merge 1 commit into
mainfrom
jasnell/clarify-jsg-trycatch
Open

Provide agent guidance on JSG_TRY vs. js.tryCatch#7067
jasnell wants to merge 1 commit into
mainfrom
jasnell/clarify-jsg-trycatch

Conversation

@jasnell

@jasnell jasnell commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

The agents keep getting this wrong

The agents keep getting this wrong
@jasnell
jasnell requested review from guybedford and npaun August 19, 2026 15:28
@jasnell
jasnell requested review from a team as code owners August 19, 2026 15:28
@jasnell
jasnell enabled auto-merge August 19, 2026 15:28
10. Final fallback: throw `"No such module"` error.

Errors are handled via `js.tryCatch`: exceptions are caught, and
Errors are handled via `JSG_TRY/JSG_CATCH`: exceptions are caught, and

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The resolve callback still uses js.tryCatch (src/workerd/jsg/modules.c++:44-145), so this documents a mechanism the callback does not use. Keep the reference aligned with its implementation.

Suggested change
Errors are handled via `JSG_TRY/JSG_CATCH`: exceptions are caught, and
Errors are handled via `js.tryCatch`: exceptions are caught, and

@ask-bonk

ask-bonk Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

I'm Bonk, and I've done a quick review of your PR.

Updates JSG exception-handling guidance and legacy module registry documentation.

  1. [P2] docs/reference/detail/legacy-module-registry.md:219 describes JSG_TRY/JSG_CATCH, but the resolver still uses js.tryCatch. Posted an inline suggestion.

github run

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.

2 participants