assert: handle undefined filename in getErrMessage by jeysal · Pull Request #20848 · nodejs/node

@nodejs-github-bot added the assert

Issues and PRs related to the assert subsystem.

label

May 20, 2018

BridgeAR

@BridgeAR BridgeAR added author ready

PRs that have at least one approval, no pending requests for changes, and a CI started.

fast-track

PRs that do not need to wait for 72 hours to land.

labels

May 20, 2018

addaleax

benjamingr

@jeysal

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

BridgeAR

XadillaX

jasnell pushed a commit that referenced this pull request

May 23, 2018
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>

@jeysal jeysal deleted the assert-error-message-undefined-filename branch

May 23, 2018 15:53

targos pushed a commit that referenced this pull request

May 25, 2018
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>