-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Node source #48357
base: main
Are you sure you want to change the base?
Node source #48357
Conversation
Co-authored-by: Rich Trott <rtrott@gmail.com>
Co-authored-by: Rich Trott <rtrott@gmail.com>
Would have been happier if I could learn why I am wrong by a comment to my PR |
Please how do I go about it,I don't think I have the permissions to do so. |
However `error.stack` does not work on Microsoft,works only on Firefox . | ||
|
||
|
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.
I think that's off-topic – this is Node.js docs, we should not document of other runtimes behavior – and also wrong (error.stack
is not defined by any standard, however every JS runtime implements it).
However `error.stack` does not work on Microsoft,works only on Firefox . |
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.
Ok if that's the standard,but why studying on w3schools it was specified under JavaScript errors ,I thought it was ok mentioning it.One time I tried logging it on my pc on a project tutorial I was following band it just never logged even though it worked on the tutorial video.
@@ -409,12 +409,15 @@ The location information will be one of: | |||
its dependencies. | |||
|
|||
The string representing the stack trace is lazily generated when the | |||
`error.stack` property is **accessed**. | |||
`error.stack` property is **accessed**. |
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.
`error.stack` property is **accessed**. | |
`error.stack` property is **accessed**. |
if (err) { | ||
console.log(err) | ||
return | ||
} |
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.
Why not throw here?
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.
If you were to go through the Node js docs Error class ,the section error first callbacks,talks about not throwing errors in error first callbacks,but I also noticed in the documentation it wasn't adhered to in other areas ,so I just changed a few to get a review from the maintainers ,then maybe it can be implemented all through.I think I wrote it in my commit message.
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.
OK I see where you come from, that Error-first callback section of the docs would need some work as it's quite outdated and not very clear. The important piece of information is here:
Lines 178 to 180 in 7df2758
Throwing an error inside the callback **can crash the Node.js process** in most | |
cases. If [domains][] are enabled, or a handler has been registered with | |
`process.on('uncaughtException')`, such errors can be intercepted. |
Crashing the process is what I would want in this case (if the operation fails, I'd expect node
to exit with a non-zero exit code); how to handle the error will depend on what your use case is, and I'm not convinced we can document it better.
Ok,I see.
…On Sun, 11 Jun 2023, 07:48 Antoine du Hamel, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In doc/api/fs.md
<#48357 (comment)>:
> + if (err) {
+ console.log(err)
+ return
+ }
OK I see where you come from, that Error-first callback
<https://nodejs.org/api/errors.html#error-first-callbacks> section of the
docs would need some work as it's quite outdated and not very clear. The
important piece of information is here:
https://github.com/nodejs/node/blob/7df27582bbb896ebb72697da58209976a0b4daf6/doc/api/errors.md#L178-L180
Crashing the process is what I would want in this case (if the operation
fails, I'd expect node to exit with a non-zero exit code); how to handle
the error will depend on what your use case is, and I'm not convinced we
can document it better.
—
Reply to this email directly, view it on GitHub
<#48357 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZDIFAI65MMWSV7VILCSZMTXKVS2ZANCNFSM6AAAAAAY4GY7PU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Hi! It's been a few months since any activity on this PR. If you wish to pursue it further, I suggest making sure it is still relevant and getting some reviews from the team. Thanks for your contribution! (CC) @nodejs/documentation |
Thanks for the notification. I thought it has been settled by aduh95 |
Ping @aduh95 This PR, IMO, doesn't seem like it adds to the file, and I don't think it'll do much good being merged. WDYT? |
No description provided.