-
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
doc: discourage error event #37264
doc: discourage error event #37264
Conversation
Could you add an entry in |
@aduh95 not technically deprecated since not technically documented 😅 I am happy to add it to deprecations.md though this isn't going through the regular cycle. |
doc/api/events.md
Outdated
|
||
Currently errors are first forwarded to the `process.on('error')` event | ||
before reaching `process.on('uncaughtException')` - this behaviour will change | ||
in the next major release to align `EventTarget` with other Node.js APIs. Any |
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 don't like naming "the next major release". I prefer if we say it is deprecated and will be removed in a future major release.
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.
Good idea, done
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.
@mcollina any chance this can get a second review? I'd prefer to make sure the changes are what you had in mind
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.
@mcollina ping (I'll also update it with Trott's suggestions before landing)
doc/api/events.md
Outdated
the other registered handlers from being invoked. | ||
by default the error is treated as an uncaught exception on | ||
`process.nextTick()`. This means uncaught exceptions in `EventTarget`s will | ||
crash the Node.js process by default. |
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.
Optional/non-blocking nit:
crash the Node.js process by default. | |
terminate the Node.js process by default. |
doc/api/events.md
Outdated
from being invoked. | ||
|
||
The `EventTarget` does not implement any special default handling for `'error'` | ||
type events like `EventEmitter` does in order to be spec compliant. |
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.
type events like `EventEmitter` does in order to be spec compliant. | |
type events like `EventEmitter` does to be spec compliant. |
...or even:
type events like `EventEmitter` does in order to be spec compliant. | |
type events like `EventEmitter` does. |
It's not clear without additional context which is being spec compliant. Is it EventTarget
being spec compliant but not implementing it? Or is it EventEmitter
being spec compliant by implementing it? (I know the answer, or at least I think I do, but a reader may not.) Then again, maybe it's not even relevant, hence the removal suggestion above.
doc/api/events.md
Outdated
before reaching `process.on('uncaughtException')` - this behaviour is | ||
deprecated and will change in a future release to align `EventTarget` with | ||
other Node.js APIs. Any code relying on the `process.on('error')` event should | ||
be aligned with the new behaviour. |
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.
We use US spellings, so this:
be aligned with the new behaviour. | |
be aligned with the new behavior. |
doc/api/events.md
Outdated
type events like `EventEmitter` does in order to be spec compliant. | ||
|
||
Currently errors are first forwarded to the `process.on('error')` event | ||
before reaching `process.on('uncaughtException')` - this behaviour is |
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.
before reaching `process.on('uncaughtException')` - this behaviour is | |
before reaching `process.on('uncaughtException')`. This behavior is |
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 with US spelling applied to behaviour
/behavior
. Other changes are optional/non-blocking.
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
322cd88
to
04625f9
Compare
04625f9
to
36173aa
Compare
PR-URL: #37264 Refs: #37237 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Landed in cf5f6af |
PR-URL: #37264 Refs: #37237 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
PR-URL: #37264 Refs: #37237 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Refs: #37237 (comment)
Refs: #37237
Basically - the "error" event is being removed from the code - it was never documented on
process
but in order to be cautious the change is still semver-major.This PR changes the wording to indicate the future behaviour.
Bikeshedding/suggestions welcome