-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
doc: improve documentation for util.types.isNativeError() #46840
Conversation
6a5b477
to
6069f89
Compare
Makes clear what a native error is by linking the spec. Explains that `instanceof Error` and util.types.isNativeError() are not equivalent. Give examples for objects that are `instance of Error` but not native errors and vice versa. Recommends checking for both if one wants to find out if something is an error.
6069f89
to
0286b65
Compare
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.
Can we add console.log
to the examples? With a console.log
, it's easier to copy and paste the examples and see the result.
Co-authored-by: Antoine du Hamel <[email protected]>
Co-authored-by: Antoine du Hamel <[email protected]>
Co-authored-by: Antoine du Hamel <[email protected]>
Co-authored-by: Antoine du Hamel <[email protected]>
Co-authored-by: Antoine du Hamel <[email protected]>
Co-authored-by: Antoine du Hamel <[email protected]>
Co-authored-by: Luigi Pinca <[email protected]>
Co-authored-by: Antoine du Hamel <[email protected]>
Commit Queue failed- Loading data for nodejs/node/pull/46840 ✔ Done loading data for nodejs/node/pull/46840 ----------------------------------- PR info ------------------------------------ Title doc: improve documentation for util.types.isNativeError() (#46840) Author Julian Dax (@brodo, first-time contributor) Branch brodo:doc-is-native-error -> nodejs:main Labels util, doc, author ready Commits 11 - doc: improve documentation for util.types.isNativeError() - Update doc/api/util.md - Update doc/api/util.md - Update doc/api/util.md - Update doc/api/util.md - Update doc/api/util.md - doc: leave out recommendation to for error checking - Update doc/api/util.md - Update doc/api/util.md - Update doc/api/util.md - doc(util.md): sort references in native order Committers 2 - Julian Dax - GitHub PR-URL: https://github.com/nodejs/node/pull/46840 Reviewed-By: Antoine du Hamel Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/46840 Reviewed-By: Antoine du Hamel Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater -------------------------------------------------------------------------------- ℹ This PR was created on Sat, 25 Feb 2023 23:40:58 GMT ✔ Approvals: 3 ✔ - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/46840#pullrequestreview-1319702237 ✔ - Luigi Pinca (@lpinca): https://github.com/nodejs/node/pull/46840#pullrequestreview-1320547265 ✔ - Ruben Bridgewater (@BridgeAR) (TSC): https://github.com/nodejs/node/pull/46840#pullrequestreview-1320693509 ✔ Last GitHub CI successful ℹ Green GitHub CI is sufficient -------------------------------------------------------------------------------- ✔ No git cherry-pick in progress ✔ No git am in progress ✔ No git rebase in progress -------------------------------------------------------------------------------- - Bringing origin/main up to date... From https://github.com/nodejs/node * branch main -> FETCH_HEAD ✔ origin/main is now up-to-date - Downloading patch for 46840 From https://github.com/nodejs/node * branch refs/pull/46840/merge -> FETCH_HEAD ✔ Fetched commits as c7e6a0c1b15e..c82066f4e673 -------------------------------------------------------------------------------- [main b04f7abe4e] doc: improve documentation for util.types.isNativeError() Author: Julian Dax Date: Sun Feb 26 00:38:59 2023 +0100 1 file changed, 35 insertions(+), 1 deletion(-) [main 99ea5b7a70] Update doc/api/util.md Author: Julian Dax Date: Sun Feb 26 20:19:02 2023 +0100 1 file changed, 1 insertion(+), 1 deletion(-) [main 298c0296a9] Update doc/api/util.md Author: Julian Dax Date: Sun Feb 26 20:19:18 2023 +0100 1 file changed, 3 insertions(+), 2 deletions(-) [main f1af1ac540] Update doc/api/util.md Author: Julian Dax Date: Sun Feb 26 20:19:45 2023 +0100 1 file changed, 3 insertions(+), 2 deletions(-) [main b778d418cf] Update doc/api/util.md Author: Julian Dax Date: Sun Feb 26 20:19:56 2023 +0100 1 file changed, 1 insertion(+), 1 deletion(-) [main 7e93057328] Update doc/api/util.md Author: Julian Dax Date: Sun Feb 26 20:20:09 2023 +0100 1 file changed, 3 insertions(+), 3 deletions(-) [main a318841938] doc: leave out recommendation to for error checking Author: Julian Dax Date: Mon Feb 27 11:37:03 2023 +0100 1 file changed, 3 insertions(+), 5 deletions(-) [main aab25b9f30] Update doc/api/util.md Author: Julian Dax Date: Mon Feb 27 12:35:32 2023 +0100 1 file changed, 1 insertion(+), 1 deletion(-) [main 9e3e55a620] Update doc/api/util.md Author: Julian Dax Date: Wed Mar 1 21:25:30 2023 +0100 1 file changed, 1 insertion(+), 1 deletion(-) [main 717ae838db] Update doc/api/util.md Author: Julian Dax Date: Wed Mar 1 22:28:41 2023 +0100 1 file changed, 1 insertion(+), 1 deletion(-) [main 234239e8a3] doc(util.md): sort references in native order Author: Julian Dax Date: Wed Mar 1 23:00:48 2023 +0100 1 file changed, 2 insertions(+), 2 deletions(-) ✔ Patches applied There are 11 commits in the PR. Attempting autorebase. Rebasing (2/22)https://github.com/nodejs/node/actions/runs/4309443060 |
Co-authored-by: James M Snell <[email protected]>
Landed in 35dd938 |
Makes clear what a native error is by linking the spec. Explains that `instanceof Error` and util.types.isNativeError() are not equivalent. Give examples for objects that are `instance of Error` but not native errors and vice versa. Recommends checking for both if one wants to find out if something is an error. PR-URL: #46840 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Makes clear what a native error is by linking the spec. Explains that `instanceof Error` and util.types.isNativeError() are not equivalent. Give examples for objects that are `instance of Error` but not native errors and vice versa. Recommends checking for both if one wants to find out if something is an error. PR-URL: #46840 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Makes clear what a native error is by linking the spec. Explains that `instanceof Error` and util.types.isNativeError() are not equivalent. Give examples for objects that are `instance of Error` but not native errors and vice versa. Recommends checking for both if one wants to find out if something is an error. PR-URL: #46840 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Makes clear what a native error is by linking the spec. Explains that
instanceof Error
andutil.types.isNativeError()
are not equivalent. Give examples for objects that areinstance of Error
but not native errors and vice versa. Recommends checking for both if one wants to find out if something is an error.