@@ -26,8 +26,6 @@ logProcessErrors(options)
2626` options ` is an optional object with the following properties:
2727
2828- [ ` log ` ` {function} ` ] ( #custom-logging )
29- - [ ` exitOnExceptions ` ` {boolean} ` ] ( #exiting-on-uncaught-exceptions ) (default:
30- ` true ` )
3129- [ ` getLevel ` ` {function} ` ] ( #log-level )
3230- [ ` getMessage ` ` {function} ` ] ( #log-message )
3331- [ ` colors ` ` {boolean} ` ] ( #log-message ) (default: ` false ` )
@@ -80,21 +78,6 @@ The function's arguments are:
8078 ` rejectionHandled ` and ` multipleResolves `
8179 - ` secondPromiseState ` , ` secondPromiseValue ` : only on ` multipleResolves `
8280
83- # Exiting on uncaught exceptions
84-
85- By default ` uncaughtException ` will fire ` process.exit(1) ` . This is the
86- recommended behavior according to the
87- [ Node.js documentation] ( https://nodejs.org/api/process.html#process_warning_using_uncaughtexception_correctly ) .
88-
89- This can disabled by setting the ` exitOnExceptions ` option to ` false ` :
90-
91- <!-- eslint-disable no-empty-function, no-unused-vars, node/no-missing-require,
92- import/no-unresolved, unicorn/filename-case, strict, no-undef -->
93-
94- ``` js
95- logProcessErrors ({ exitOnExceptions: false })
96- ```
97-
9881# Log level
9982
10083By default the log level will be ` warn ` for ` warning ` events and ` error ` for
@@ -150,6 +133,16 @@ logProcessErrors({
150133})
151134```
152135
136+ # Uncaught exceptions
137+
138+ ` uncaughtException ` events will fire ` process.exit(1) ` . This is the recommended
139+ behavior according to the
140+ [ Node.js documentation] ( https://nodejs.org/api/process.html#process_warning_using_uncaughtexception_correctly ) .
141+
142+ ` process.exit(1) ` will only be fired after the ` uncaughtException ` event has
143+ been logged. If an custom ` log ` option is used and it is asynchronous, the
144+ function should return a promise (or use ` async ` /` await ` ).
145+
153146# Stop logging
154147
155148Logging can be stopped by firing the function returned by ` logProcessErrors() `
0 commit comments