-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
src: expose V8's IsNativeError() in util bindings #12546
Conversation
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.
LGTM, but I’d say you can feel free to pick this into your other PR if you like
test/parallel/test-util.js
Outdated
assert.strictEqual(binding.isNativeError(new TypeError()), true); | ||
assert.strictEqual(binding.isNativeError(new SyntaxError()), true); | ||
/* eslint-disable new-parens */ | ||
assert.strictEqual(binding.isNativeError(new (context('Error'))), true); |
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.
new (context('Error'))()
I think that should fulfill the "new-parens" ESLint rule as well.
Refs: nodejs#12400 PR-URL: nodejs#12546 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
cfd869e
to
e522bcd
Compare
Landed with @TimothyGu's suggestion. |
I get this error when backporting this to v6.x, which I assume means that this shouldn't land. LMK if that's not the case.
|
Fwiw the v8 patch that would fix that failure is v8/v8@a2dad04, I think. |
If this is something that's worth landing on Node 6, then a backport PR with e522bcd and v8/v8@a2dad04 would be welcome. |
Exposes
IsNativeError()
throughprocess.binding('util')
. The tests are copied fromutil.isError()
. The results are the same with the exception of the last one (object inheriting fromError
).R= @addaleax because of #12400 (comment)
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
src