Skip to content

Conversation

@benjamingr
Copy link
Member

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

@benjamingrbenjamingr added the doc Issues and PRs related to the documentations. label Feb 7, 2021
@nodejs-github-botnodejs-github-bot added the events Issues and PRs related to the events subsystem / EventEmitter. label Feb 7, 2021
@aduh95aduh95 added semver-major PRs that contain breaking changes and should be released in the next major version. and removed semver-major PRs that contain breaking changes and should be released in the next major version. labels Feb 7, 2021
@aduh95
Copy link
Contributor

Could you add an entry in deprecations.md?

@benjamingr
Copy link
MemberAuthor

@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.


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
Copy link
Member

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.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, done

Copy link
MemberAuthor

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

Copy link
MemberAuthor

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)

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.
Copy link
Member

@TrottTrottFeb 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional/non-blocking nit:

Suggested change
crash the Node.js process by default.
terminate the Node.js process by default.

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type events like `EventEmitter` does in order to be spec compliant.
type events like `EventEmitter` does to be spec compliant.

...or even:

Suggested change
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.

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.
Copy link
Member

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:

Suggested change
be aligned with the new behaviour.
be aligned with the new behavior.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
before reaching `process.on('uncaughtException')` - this behaviour is
before reaching `process.on('uncaughtException')`. This behavior is

Copy link
Member

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

@benjamingr
Copy link
MemberAuthor

@Trott any chance you could also review #37237 ? Landing this one doesn't make a ton of sense without that one :)

Copy link
Member

@mcollinamcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@benjamingrbenjamingrforce-pushed the event-target-error-event branch from 322cd88 to 04625f9CompareFebruary 11, 2021 12:05
@benjamingrbenjamingrforce-pushed the event-target-error-event branch from 04625f9 to 36173aaCompareFebruary 11, 2021 12:11
benjamingr added a commit that referenced this pull request Feb 11, 2021
PR-URL: #37264 Refs: #37237 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
@benjamingr
Copy link
MemberAuthor

Landed in cf5f6af

danielleadams pushed a commit that referenced this pull request Feb 16, 2021
PR-URL: #37264 Refs: #37237 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
This was referenced Feb 16, 2021
targos pushed a commit that referenced this pull request May 1, 2021
PR-URL: #37264 Refs: #37237 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
@danielleadamsdanielleadams mentioned this pull request May 3, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docIssues and PRs related to the documentations.eventsIssues and PRs related to the events subsystem / EventEmitter.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@benjamingr@aduh95@mcollina@Trott@addaleax@nodejs-github-bot