[英]How to avoid http2 connect from crashing Node.js
const client = http2.
connect('https://domain.doesnt.exist').
on('error', e => {
console.error(e.message);
});
在 Node.js 13.6.0 上,即使提供了错误侦听器,上述代码也会使整个过程崩溃。
我将如何避免它?
您可以使用uncaughtException
事件来记录所有uncaughtException
异常..
process.on('uncaughtException', err => {
console.log(err.message);
console.log(err.stack);
process.exit(1)
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.