-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
assert: handle undefined filename in getErrMessage #20848
assert: handle undefined filename in getErrMessage #20848
Conversation
@jeysal thanks a lot for reporting and fixing this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent first contribution - good job!
CI failures look unrelated. Retried just in case https://ci.nodejs.org/job/node-test-commit/18635/console |
Just my 2c but wouldn't we prefer to just bail out early before even checking the Map? Then we don't need to store extra values or run all that extra code... |
@apapirovski we could bail out right after checking for a filename but that should not make a significant difference. |
I guess that would indeed save some cache entries. Might look nicer to have both exit conditions in one place though. Would anyone else prefer splitting them? |
@jeysal if you do not mind, moving would be better. |
d267d28
to
86b8330
Compare
When generating an assertion error message, `filename` might be undefined, e.g. if `assert` is called in `eval`. Handle this case gracefully instead of failing with `Cannot read property 'endsWith' of undefined`. Fixes: nodejs#20847
86b8330
to
0118fcd
Compare
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still LG
Way too much red and yellow in the last CI run, trying again: https://ci.nodejs.org/job/node-test-pull-request/15055/ |
Still a lot of red in the CI but none of it related. |
When generating an assertion error message, `filename` might be undefined, e.g. if `assert` is called in `eval`. Handle this case gracefully instead of failing with `Cannot read property 'endsWith' of undefined`. Fixes: #20847 PR-URL: #20848 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in a5d86f8 |
When generating an assertion error message, `filename` might be undefined, e.g. if `assert` is called in `eval`. Handle this case gracefully instead of failing with `Cannot read property 'endsWith' of undefined`. Fixes: #20847 PR-URL: #20848 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: James M Snell <jasnell@gmail.com>
When generating an assertion error message,
filename
might be undefined,e.g. if
assert
is called ineval
.Handle this case gracefully instead of failing with
Cannot read property 'endsWith' of undefined
.Fixes: #20847
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes