- Minimal supported Node.js version is now
18.18.0
- Upgrade internal dependencies
- Minimal supported Node.js version is now
16.17.0
- Improve tree-shaking support
- Add more tests
- Improve error detection using
is-error-instance
The npm package size has been reduced by 98%, from 4500kB to 87kB.
The log
option was renamed to onError
. Its arguments
are (originalError, event)
instead of (error, level, originalError)
.
The process error event
is now passed as a second argument instead of being
set as error.name
. Its case is not capitalized anymore, to match the event
name in Node.js.
Before:
logProcessErrors({
log: (error) => {
if (error.name === 'UncaughtException') {
console.error(error)
}
},
})
After:
logProcessErrors({
onError: (error, event) => {
if (event === 'uncaughtException') {
console.error(error)
}
},
})
Errors are not pretty-printed anymore. As a consequence, the colors
option was
removed too. The onError
option can be used instead to
customize how the errors are printed.
The levels
option was removed. The onError
option can
be used for filtering.
Before:
logProcessErrors({
levels: {
warning: 'silent',
},
})
After:
logProcessErrors({
onError: (error, event) => {
if (event !== 'warning') {
console.error(error)
}
},
})
The testing
option was removed. The onError
option can
be used instead.
Before:
logProcessErrors({ testing: 'ava' })
After:
logProcessErrors({
// Throw the `error` to make the unit test fail while letting other tests run
onError: (error) => {
throw error
},
})
The exitOn
option was changed from an array of strings to a simpler boolean.
It was also renamed exit
.
The exit is still graceful, i.e. it waits for ongoing tasks to complete, up to 3 seconds. However, if there are none, the process now exits immediately.
Before:
logProcessErrors({ exitOn: [] })
After:
logProcessErrors({ exit: false })
If other libraries (such as
Winston,
Bugsnag,
etc.) are also listening for process events, they might also try to exit the
process. This created conflicts with this library. This has been fixed by making
the exit
option default to false
when process events
listeners already exist.
- Fix support for
--unhandled-rejections=strict
- Do not crash when
error.stack
isundefined
ornull
- Support cross-realm errors
TypeScript types have been simplified.
Added 100% test coverage.
- Reduce npm package size
- Document related projects, including
modern-errors
- Reduce npm package size
- Add TypeScript types
- Minimal supported Node.js version is now
14.18.0
multipleResolves
has been deprecated by Node.js. Therefore, support for it has been removed.- If your code uses the
level
orexitOn
option with amultipleResolves
parameter, you should remove it. - Otherwise, this release is not a breaking change for you.
- If your code uses the
- Fix
main
field inpackage.json
- The
log-process-errors/build/register
export has been removed. Please importlog-process-errors
directly instead. - The
testing
option valuenode-tap
has been renamed tonode_tap
- Minimal supported Node.js version is now
12.20.0
- This package is now an ES module. It can only be loaded with an
import
orimport()
statement, notrequire()
. See this post for more information.
- Improve colors detection
- Improve colors on Windows terminal
- The
exitOn()
option now defaults to['uncaughtException', 'unhandledRejection']
on Node>= 15.0.0
. Its default value is still['uncaughtException']
on Node< 15.0.0
. This is to mimic Node.js default behavior: since Node15.0.0
, processes exit on unhandled promises.
- Fix handling uncaught exceptions or warnings that are not
Error
instances (#32)
- Pass original error to
log()
option
- Do not remove error static properties
- Remove unused dependency
core-js
- Minimal supported Node.js version is now
10.17.0
- Remove unused dependency
core-js
- Fix handling uncaught exceptions or warnings that are not
Error
instances (#32)
- Pass original error to
log()
option
- Do not remove error static properties
- Do not make tests fail on
multipleResolves
events with thetesting
option
- Do not handle deprecation warnings on unhandled rejection promises anymore
since this is due to a bug in Node
12.6.0
which has been fixed in12.7.0
.
- Do not print deprecation warnings on unhandled rejection promises with Node
12.6.0
- Upgrade
supports-color
Thanks to @Hongarc and @stevenvachon for their first-time contributions!
- Minimum Node.js version is now
8.12.0
(instead of8.10.0
)
- Improve documentation and examples
- Upgrade development dependencies
- Code refactoring
- Improve linting
- Upgrade
figures
- Upgrade
moize
- Upgrade development dependencies
- Code refactoring
- Use ES modules
- Rename
log-process-errors/register
tolog-process-errors/build/register