【发布时间】:2023-01-19 23:08:47
【问题描述】:
我想在节点进程上测试异常。而不是像error.js 文件那样注册处理程序。
error.js
process.on("uncaughtException", (ex) => {
//logging
process.exit(-1);
});
【问题讨论】:
我想在节点进程上测试异常。而不是像error.js 文件那样注册处理程序。
error.js
process.on("uncaughtException", (ex) => {
//logging
process.exit(-1);
});
【问题讨论】:
抱歉,我还没有评论权限,但您可以编写一个函数,在测试前抛出一个 uncaughtException 调用。如果这有效,请告诉我。
【讨论】: