Skip to content
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

Merged
merged 12 commits into from
Mar 18, 2023

Conversation

brodo
Copy link
Contributor

@brodo brodo commented Feb 25, 2023

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.

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. util Issues and PRs related to the built-in util module. labels Feb 25, 2023
@brodo brodo force-pushed the doc-is-native-error branch 2 times, most recently from 6a5b477 to 6069f89 Compare February 25, 2023 23:44
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.
Copy link
Contributor

@aduh95 aduh95 left a 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.

doc/api/util.md Outdated Show resolved Hide resolved
doc/api/util.md Outdated Show resolved Hide resolved
doc/api/util.md Outdated Show resolved Hide resolved
doc/api/util.md Outdated Show resolved Hide resolved
doc/api/util.md Outdated Show resolved Hide resolved
doc/api/util.md Outdated Show resolved Hide resolved
brodo and others added 6 commits February 26, 2023 20:19
doc/api/util.md Outdated Show resolved Hide resolved
Co-authored-by: Antoine du Hamel <[email protected]>
@aduh95 aduh95 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 1, 2023
doc/api/util.md Outdated Show resolved Hide resolved
Co-authored-by: Luigi Pinca <[email protected]>
doc/api/util.md Outdated Show resolved Hide resolved
Co-authored-by: Antoine du Hamel <[email protected]>
doc/api/util.md Outdated Show resolved Hide resolved
@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 1, 2023
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Mar 2, 2023
@nodejs-github-bot
Copy link
Collaborator

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)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
doc: improve documentation for util.types.isNativeError()

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]

[detached HEAD dfdb46ba3a] doc: improve documentation for util.types.isNativeError()
Author: Julian Dax [email protected]
Date: Sun Feb 26 00:38:59 2023 +0100
1 file changed, 35 insertions(+), 1 deletion(-)
Rebasing (3/22)
Rebasing (4/22)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
Update doc/api/util.md

Co-authored-by: Antoine du Hamel [email protected]
PR-URL: #46840
Reviewed-By: Antoine du Hamel [email protected]
Reviewed-By: Luigi Pinca [email protected]
Reviewed-By: Ruben Bridgewater [email protected]

[detached HEAD 874022f32e] Update doc/api/util.md
Author: Julian Dax [email protected]
Date: Sun Feb 26 20:19:02 2023 +0100
1 file changed, 1 insertion(+), 1 deletion(-)
Rebasing (5/22)
Rebasing (6/22)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
Update doc/api/util.md

Co-authored-by: Antoine du Hamel [email protected]
PR-URL: #46840
Reviewed-By: Antoine du Hamel [email protected]
Reviewed-By: Luigi Pinca [email protected]
Reviewed-By: Ruben Bridgewater [email protected]

[detached HEAD e3953e77db] Update doc/api/util.md
Author: Julian Dax [email protected]
Date: Sun Feb 26 20:19:18 2023 +0100
1 file changed, 3 insertions(+), 2 deletions(-)
Rebasing (7/22)
Rebasing (8/22)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
Update doc/api/util.md

Co-authored-by: Antoine du Hamel [email protected]
PR-URL: #46840
Reviewed-By: Antoine du Hamel [email protected]
Reviewed-By: Luigi Pinca [email protected]
Reviewed-By: Ruben Bridgewater [email protected]

[detached HEAD 3ea887f6cd] Update doc/api/util.md
Author: Julian Dax [email protected]
Date: Sun Feb 26 20:19:45 2023 +0100
1 file changed, 3 insertions(+), 2 deletions(-)
Rebasing (9/22)
Rebasing (10/22)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
Update doc/api/util.md

Co-authored-by: Antoine du Hamel [email protected]
PR-URL: #46840
Reviewed-By: Antoine du Hamel [email protected]
Reviewed-By: Luigi Pinca [email protected]
Reviewed-By: Ruben Bridgewater [email protected]

[detached HEAD 26540f4282] Update doc/api/util.md
Author: Julian Dax [email protected]
Date: Sun Feb 26 20:19:56 2023 +0100
1 file changed, 1 insertion(+), 1 deletion(-)
Rebasing (11/22)
Rebasing (12/22)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
Update doc/api/util.md

Co-authored-by: Antoine du Hamel [email protected]
PR-URL: #46840
Reviewed-By: Antoine du Hamel [email protected]
Reviewed-By: Luigi Pinca [email protected]
Reviewed-By: Ruben Bridgewater [email protected]

[detached HEAD 0797b23018] Update doc/api/util.md
Author: Julian Dax [email protected]
Date: Sun Feb 26 20:20:09 2023 +0100
1 file changed, 3 insertions(+), 3 deletions(-)
Rebasing (13/22)
Rebasing (14/22)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
doc: leave out recommendation to for error checking

PR-URL: #46840
Reviewed-By: Antoine du Hamel [email protected]
Reviewed-By: Luigi Pinca [email protected]
Reviewed-By: Ruben Bridgewater [email protected]

[detached HEAD eb5127889a] doc: leave out recommendation to for error checking
Author: Julian Dax [email protected]
Date: Mon Feb 27 11:37:03 2023 +0100
1 file changed, 3 insertions(+), 5 deletions(-)
Rebasing (15/22)
Rebasing (16/22)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
Update doc/api/util.md

Co-authored-by: Antoine du Hamel [email protected]
PR-URL: #46840
Reviewed-By: Antoine du Hamel [email protected]
Reviewed-By: Luigi Pinca [email protected]
Reviewed-By: Ruben Bridgewater [email protected]

[detached HEAD 4bd5605320] Update doc/api/util.md
Author: Julian Dax [email protected]
Date: Mon Feb 27 12:35:32 2023 +0100
1 file changed, 1 insertion(+), 1 deletion(-)
Rebasing (17/22)
Rebasing (18/22)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
Update doc/api/util.md

Co-authored-by: Luigi Pinca [email protected]
PR-URL: #46840
Reviewed-By: Antoine du Hamel [email protected]
Reviewed-By: Luigi Pinca [email protected]
Reviewed-By: Ruben Bridgewater [email protected]

[detached HEAD 5daba1d010] Update doc/api/util.md
Author: Julian Dax [email protected]
Date: Wed Mar 1 21:25:30 2023 +0100
1 file changed, 1 insertion(+), 1 deletion(-)
Rebasing (19/22)
Rebasing (20/22)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
Update doc/api/util.md

Co-authored-by: Antoine du Hamel [email protected]
PR-URL: #46840
Reviewed-By: Antoine du Hamel [email protected]
Reviewed-By: Luigi Pinca [email protected]
Reviewed-By: Ruben Bridgewater [email protected]

[detached HEAD 90572c979d] Update doc/api/util.md
Author: Julian Dax [email protected]
Date: Wed Mar 1 22:28:41 2023 +0100
1 file changed, 1 insertion(+), 1 deletion(-)
Rebasing (21/22)
Rebasing (22/22)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
doc(util.md): sort references in native order

PR-URL: #46840
Reviewed-By: Antoine du Hamel [email protected]
Reviewed-By: Luigi Pinca [email protected]
Reviewed-By: Ruben Bridgewater [email protected]

[detached HEAD 57d92ddc24] doc(util.md): sort references in native order
Author: Julian Dax [email protected]
Date: Wed Mar 1 23:00:48 2023 +0100
1 file changed, 2 insertions(+), 2 deletions(-)

Successfully rebased and updated refs/heads/main.

ℹ Add commit-queue-squash label to land the PR as one commit, or commit-queue-rebase to land as separate commits.

https://github.com/nodejs/node/actions/runs/4309443060

doc/api/util.md Outdated Show resolved Hide resolved
Co-authored-by: James M Snell <[email protected]>
@aduh95 aduh95 added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Mar 18, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 18, 2023
@nodejs-github-bot nodejs-github-bot merged commit 35dd938 into nodejs:main Mar 18, 2023
@nodejs-github-bot
Copy link
Collaborator

Landed in 35dd938

RafaelGSS pushed a commit that referenced this pull request Apr 5, 2023
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]>
@RafaelGSS RafaelGSS mentioned this pull request Apr 6, 2023
RafaelGSS pushed a commit that referenced this pull request Apr 7, 2023
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]>
danielleadams pushed a commit that referenced this pull request Jul 6, 2023
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. doc Issues and PRs related to the documentations. util Issues and PRs related to the built-in util module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants