Repository navigation
Throw a failing Rust builtin module's own error in the new module registry - #8581
Merged
Merged
Conversation
…istry When the callback of a Rust builtin module failed, RustBuiltinModuleAdapter threw jsg::JsExceptionThrown out of the synthetic module's evaluate callback. The new registry's evaluationSteps catches every C++ exception with KJ_CATCH, so the importer got "Error: internal error" instead of the module's error, and the runtime logged "Uncaught JsExceptionThrown". The legacy registry already passes the error through. In this patch the adapter returns false with the exception pending, as the text, data and JSON module handlers do, so V8 throws the module's own error. The legacy adapter still throws JsExceptionThrown, which its registry expects. io-context-test now imports a failing Rust module twice through each registry. The new-registry case fails without the fix.
There was a problem hiding this comment.
✅ Approved — This is a small, correct fix that follows how the existing synthetic modules report errors, and it adds tests for both registries. I found no issues.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🔒 Security: ✅ LGTM
No issues found.
📖 AGENTS.md: ✅ LGTM
No issues found.
📋 Code Quality: ✅ LGTM
No issues found.
⚡ Performance: ✅ LGTM
No issues found.
📝 Documentation: ✅ LGTM
No issues found.
Reviewed commit: a6884f1b
guybedford
approved these changes
Nov 19, 2026
guybedford
left a comment
Member
There was a problem hiding this comment.
LGTM. Verified locally that the new-registry test fails with Error: internal error without the adapter change and passes with it.
littledivy
added a commit
that referenced
this pull request
Nov 20, 2026
#8581 and #8597 fixed how the new module registry reports a failing Rust builtin module callback, and the commit messages cover a termination as well as a thrown error. Only the thrown error was tested for Rust modules. In this patch a Rust test module's callback terminates execution, and a test for each registry checks that resolving it throws with the termination still in place. With both fixes reverted, the new registry's test fails because an internal error replaces the termination.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a Rust builtin module's callback failed,
RustBuiltinModuleAdapterthrewjsg::JsExceptionThrownout of the synthetic module's evaluate callback. The new registry'sevaluationStepscatches every C++ exception withKJ_CATCH, so the importer gotError: internal errorinstead of the module's own error, and the runtime logged "Uncaught JsExceptionThrown". The legacy registry already passes the error through.In this patch the adapter returns
falsewith the exception pending, as the text, data and JSON module handlers do, so V8 throws the module's own error. The legacy adapter still throwsJsExceptionThrown, which its registry expects. io-context-test now imports a failing Rust module twice through each registry. The new-registry case fails without the fix.