Skip to content

Releases: ehmicky/log-process-errors

v12.0.0

28 Oct 22:22
Compare
Choose a tag to compare

Breaking changes

  • Minimal supported Node.js version is now 18.18.0

v11.0.1

14 May 00:11
Compare
Choose a tag to compare

Dependencies

  • Upgrade internal dependencies

v11.0.0

13 May 23:52
Compare
Choose a tag to compare

Breaking changes

  • Minimal supported Node.js version is now 16.17.0

Release 10.2.0

11 Nov 18:38
Compare
Choose a tag to compare

Features

  • Improve tree-shaking support

Release 10.1.1

16 Oct 15:59
Compare
Choose a tag to compare

Internal

  • Add more tests

Release 10.1.0

13 Oct 18:19
Compare
Choose a tag to compare

Features

Release 10.0.0

11 Oct 17:53
Compare
Choose a tag to compare

Package size

The npm package size has been reduced by 98%, from 4500kB to 87kB.

Custom logic

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)
    }
  },
})

Pretty-printing

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.

Filtering

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)
    }
  },
})

Testing option

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
  },
})

Process exit

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 })

Compatibility with other libraries

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.

Bug fixes

  • Fix support for --unhandled-rejections=strict
  • Do not crash when error.stack is undefined or null
  • Support cross-realm errors

TypeScript

TypeScript types have been simplified.

Internal

Added 100% test coverage.

Release 9.4.0

08 Oct 20:56
Compare
Choose a tag to compare

Features

  • Reduce npm package size

Release 9.3.0

17 Aug 18:07
Compare
Choose a tag to compare

Documentation

Release 9.2.0

16 Aug 19:19
Compare
Choose a tag to compare

Features

  • Reduce npm package size