util: improve internal isError() validation#24746
Closed
BridgeAR wants to merge 5 commits intonodejs:masterfrom
Closed
util: improve internal isError() validation#24746BridgeAR wants to merge 5 commits intonodejs:masterfrom
isError() validation#24746BridgeAR wants to merge 5 commits intonodejs:masterfrom
Conversation
The current internal isError function checked the toString value instead of using the more precise `util.types.isNativeError()` check. The `instanceof` check is not removed due to possible errors that are not native but still an instance of Error.
Member
Author
sam-github
reviewed
Nov 30, 2018
Contributor
sam-github
left a comment
There was a problem hiding this comment.
I think this should have some unit tests, specifically, some that failed before the change and succeed afterwards. My js isn't good enough, I don't understand the subtleties of how it is becoming more precise, and was hoping to learn what corner cases are better covered from the tests.
Member
Author
|
I just pushed some tests as well. |
Member
Author
|
@nodejs/util PTAL |
targos
approved these changes
Dec 2, 2018
joyeecheung
reviewed
Dec 2, 2018
joyeecheung
reviewed
Dec 2, 2018
joyeecheung
approved these changes
Dec 2, 2018
Member
Author
BridgeAR
added a commit
to BridgeAR/node
that referenced
this pull request
Dec 3, 2018
The current internal isError function checked the toString value instead of using the more precise `util.types.isNativeError()` check. The `instanceof` check is not removed due to possible errors that are not native but still an instance of Error. PR-URL: nodejs#24746 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Member
Author
|
Landed in 2b5f2bc |
BridgeAR
added a commit
that referenced
this pull request
Dec 5, 2018
The current internal isError function checked the toString value instead of using the more precise `util.types.isNativeError()` check. The `instanceof` check is not removed due to possible errors that are not native but still an instance of Error. PR-URL: #24746 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This was referenced Dec 7, 2018
refack
pushed a commit
to refack/node
that referenced
this pull request
Jan 14, 2019
The current internal isError function checked the toString value instead of using the more precise `util.types.isNativeError()` check. The `instanceof` check is not removed due to possible errors that are not native but still an instance of Error. PR-URL: nodejs#24746 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
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.
The current internal isError function checked the toString value
instead of using the more precise
util.types.isNativeError()check.The
instanceofcheck is not removed due to possible errors thatare not native but still an instance of Error.
The internal
isErrorfunction is only used inutil.inspect()and therepl.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes