| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1238,12 +1238,21 @@ target.addEventListener('foo', handler4, { once: true }); | |||
| 1238 | 1238 | ### `EventTarget` error handling | |
| 1239 | 1239 | ||
| 1240 | 1240 | When a registered event listener throws (or returns a Promise that rejects), | |
| 1241 | - by default the error is forwarded to the `process.on('error')` event | ||
| 1242 | - on `process.nextTick()`. Throwing within an event listener will *not* stop | ||
| 1243 | - the other registered handlers from being invoked. | ||
| 1241 | + by default the error is treated as an uncaught exception on | ||
| 1242 | + `process.nextTick()`. This means uncaught exceptions in `EventTarget`s will | ||
| 1243 | + terminate the Node.js process by default. | ||
| 1244 | 1244 | ||
| 1245 | - The `EventTarget` does not implement any special default handling for | ||
| 1246 | - `'error'` type events. | ||
| 1245 | + Throwing within an event listener will *not* stop the other registered handlers | ||
| 1246 | + from being invoked. | ||
| 1247 | + | ||
| 1248 | + The `EventTarget` does not implement any special default handling for `'error'` | ||
| 1249 | + type events like `EventEmitter`. | ||
| 1250 | + | ||
| 1251 | + Currently errors are first forwarded to the `process.on('error')` event | ||
| 1252 | + before reaching `process.on('uncaughtException')`. This behavior is | ||
| 1253 | + deprecated and will change in a future release to align `EventTarget` with | ||
| 1254 | + other Node.js APIs. Any code relying on the `process.on('error')` event should | ||
| 1255 | + be aligned with the new behavior. | ||
| 1247 | 1256 | ||
| 1248 | 1257 | ### Class: `Event` | |
| 1249 | 1258 | <!-- YAML | |
| Back | FazBrowse Home | New Git URL |
0 commit comments