Node.js不会在uncaughtException上显示完整的错误信息,可能吗?

在node.js中,如果你捕获了uncaughtExceptions,像这样:

process.on('uncaughtException', function (error) { console.log(error); }); 

显示的错误消息不包含您收到的所有信息,如果您没有发现错误并让进程崩溃。 当你让进程崩溃时,它包括哪一行导致错误。 有什么办法来得到完整的错误信息,包括导致错误的行,所以我们可以使用uncaughtExceptionlogging这些数据。

尝试error.stack

 process.on('uncaughtException', function (error) { console.log(error.stack); }); 

尝试:

 process.on('uncaughtException', function (error) { console.dir(error); });