0
  const client = http2.
    connect('https://domain.doesnt.exist').
    on('error', e => {
      console.error(e.message);
    });

On Node.js 13.6.0, even when provided an error listener, the above code would crash the entire process.

How will I be able to avoid it?

Aero Wang
  • 8,382
  • 14
  • 63
  • 99

1 Answers1

0

you can use uncaughtException event to log all exceptions not been caught..

process.on('uncaughtException', err => {
  console.log(err.message);
  console.log(err.stack);
  process.exit(1)
})
MarkoCen
  • 2,189
  • 13
  • 24