We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e28fa6c commit 3464c9fCopy full SHA for 3464c9f
1 file changed
doc/api/events.md
@@ -1247,12 +1247,21 @@ target.addEventListener('foo', handler4, { once: true });
1247
### `EventTarget` error handling
1248
1249
When a registered event listener throws (or returns a Promise that rejects),
1250
-by default the error is forwarded to the `process.on('error')` event
1251
-on `process.nextTick()`. Throwing within an event listener will *not* stop
1252
-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
+terminate the Node.js process by default.
1253
1254
-The `EventTarget` does not implement any special default handling for
1255
-`'error'` type events.
+Throwing within an event listener will *not* stop the other registered handlers
+from being invoked.
1256
+
1257
+The `EventTarget` does not implement any special default handling for `'error'`
1258
+type events like `EventEmitter`.
1259
1260
+Currently errors are first forwarded to the `process.on('error')` event
1261
+before reaching `process.on('uncaughtException')`. This behavior is
1262
+deprecated and will change in a future release to align `EventTarget` with
1263
+other Node.js APIs. Any code relying on the `process.on('error')` event should
1264
+be aligned with the new behavior.
1265
1266
### Class: `Event`
1267
<!-- YAML
0 commit comments