lib: fix ERR_INVALID_ARG_TYPE with --enable-source-maps#63215
Open
kimjune01 wants to merge 1 commit intonodejs:mainfrom
Open
lib: fix ERR_INVALID_ARG_TYPE with --enable-source-maps#63215kimjune01 wants to merge 1 commit intonodejs:mainfrom
kimjune01 wants to merge 1 commit intonodejs:mainfrom
Conversation
When --enable-source-maps is enabled but no source map is registered for a script (e.g. a plain .mjs file), getErrorSourceLocation() returned undefined. This caused getErrMessage() to return undefined, which made innerOk() pass [undefined] as the message tuple to innerFail(), hitting the ERR_INVALID_ARG_TYPE guard instead of throwing an AssertionError. Fix all code paths in getErrorSourceLocation() that returned bare undefined to fall back to the raw generated source line, matching the behavior when source maps are disabled entirely. Also add a defensive guard for when V8 fails to provide a source line at all. Fixes: nodejs#63169
Member
|
@kimjune01 I think the commit's module should be |
Author
|
Good point β the root cause is in the source map resolution path, not assert itself. I'll update the title. |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
Member
@kimjune01 please reword the commit as well ππ½ |
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
--enable-source-mapsis enabled but no source map exists for the script (e.g. a plain.mjsfile),getErrorSourceLocation()returnedundefined. This causedgetErrMessage()to returnundefined, which madeinnerOk()pass[undefined]as the message tuple toinnerFail(), hitting theERR_INVALID_ARG_TYPEguard instead of throwingAssertionError.Fix all code paths in
getErrorSourceLocation()that returned bareundefinedto fall back to the raw generated source line, matching the behavior when source maps are disabled entirely. Also add a guard for when V8 fails to provide a source line at all.Includes tests for both
.mjsand.cjsfiles under--enable-source-maps.Fixes: #63169