fix(core): add missing catch handler for forward-ref provider resolution#16133
Merged
kamilmysliwiec merged 1 commit intonestjs:masterfrom Dec 29, 2025
Merged
Conversation
When forwardRef provider fails to load in a non-static context (REQUEST/TRANSIENT scope, the error was silently swallowed because the promise was fire-and-forget without catch handler This fix add catch handler that propagate the error through ettlementSignal, ensuring proper error handling and preventing unhandled promise rejection
Pull Request Test Coverage Report for Build 2097797b-97a8-412e-a64d-a1f81ae9b453Details
💛 - Coveralls |
Member
|
Out of curiosity: could you provide a minimum reproduction repository (that shows when the unhandled error occurs)? |
Contributor
Author
|
Sure, I'll prepare a reproduction repository and mention you once it's ready. |
Contributor
Author
|
@kamilmysliwiec Here's the reproduction repository: https://github.com/coti-z/unhandledRejection Steps:
Expected: BService throws → error propagates → request fails with 500 Let me know if you need anything else! |
Member
|
thanks @coti-z |
Contributor
Author
|
Glad I could help! |
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.
PR Checklist
PR Type
What is the current behavior?
Why is this a problem?
When a
forwardRefprovider fails to load in a non-static context (REQUEST/TRANSIENT scope), the error is silently swallowed. This happens because the promise chain inresolveComponentHostuses fire-and-forget pattern without a.catch()handler, causing unhandled promise rejections.What is the new behavior?
Added a
.catch()handler that propagates errors throughsettlementSignal.error(), matching the existing error handling pattern used elsewhere in the injector.Does this PR introduce a breaking change?
Other information
loadInstance(lines 196-203).