-
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
Error "message" property enumerability change on 9.7.0+ #19716
Comments
If I had to guess, it may be 1246902. One difference is that no message is being passed to the |
@alexjeffburke Yes that's the intended behavior, because most errors coming out of Node.js or the JS engine does not have a enumerable |
Also, to test against errors coming out of Node.js v8 and above, a better way is to test against (a subset of) their properties, e.g. |
Oops, I think I misread the OP, it was talking about |
@mscdex yeah I think it is exactly that - within the commit you linked it's this ending up as that. @joyeecheung yep it's a defined quirk in the spec. I know checking those properties or perhaps soon a standard error code is the more correct way, but pretty sure this change was unintentional and it does rather subtly change behaviour. @BridgeAR thanks for jumping on it. |
A error message should always be non-enumerable. This makes sure that is true for dns errors as well. It also adds another check in `common.expectsError` to make sure no other regressions are introduced going forward. Fixes nodejs#19716
A error message should always be non-enumerable. This makes sure that is true for dns errors as well. It also adds another check in `common.expectsError` to make sure no other regressions are introduced going forward. Fixes nodejs#19716 PR-URL: nodejs#19719 Fixes: nodejs#19716 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]>
A error message should always be non-enumerable. This makes sure that is true for dns errors as well. It also adds another check in `common.expectsError` to make sure no other regressions are introduced going forward. Fixes nodejs#19716 PR-URL: nodejs#19719 Fixes: nodejs#19716 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]>
A error message should always be non-enumerable. This makes sure that is true for dns errors as well. It also adds another check in `common.expectsError` to make sure no other regressions are introduced going forward. Fixes #19716 Backport-PR-URL: #19191 PR-URL: #19719 Fixes: #19716 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]>
A error message should always be non-enumerable. This makes sure that is true for dns errors as well. It also adds another check in `common.expectsError` to make sure no other regressions are introduced going forward. Fixes #19716 Backport-PR-URL: #19191 PR-URL: #19719 Fixes: #19716 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]>
A error message should always be non-enumerable. This makes sure that is true for dns errors as well. It also adds another check in `common.expectsError` to make sure no other regressions are introduced going forward. Fixes #19716 Backport-PR-URL: #19191 PR-URL: #19719 Fixes: #19716 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]>
Background
There appears to be a change in the enumerability of the "message" property on at least errors coming up from the getaddrinfo system call that were noticed when a number of tests for the Unexpected project and a number of it's plugins started failing. After looking into and rolling out code changes I was able to beset node versions, and it seems this issue was introduced between 9.6.1 and 9.7.0.
The follwing code should demonstrate the issue:
Expected outcome
Both version of node report the same number of enumerable keys and message is not included.
Actual outcome
9.6.1: 'Error with 4 enumerable keys WITHOUT "message"'
9.7.0: 'Error with 5 enumerable keys WITH "message"'
Summary
I hope the above is enough to explain the issue. Based on the workaround we applied, it seems likely that these errors were previously instantiated by passing the message into the constructor but were changed so the message was attached after the fact.
If there's anything else I can provide please let me know.
Thanks
The text was updated successfully, but these errors were encountered: