提交 c09c7208 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Print error.stack in 'unhandledRejection' event

上级 07082890
...@@ -73,7 +73,14 @@ process.on('exit', () => ...@@ -73,7 +73,14 @@ process.on('exit', () =>
// NOTE: Those events could be fired due to user code or other running libraries // NOTE: Those events could be fired due to user code or other running libraries
process.on('unhandledRejection', (reason) => process.on('unhandledRejection', (reason) =>
{ {
logger.warn('"unhandledRejection" event due to a Promise being rejected with no error handler [reason:%o]', reason); if (reason instanceof Error)
{
logger.warn('"unhandledRejection" event due to a Promise being rejected with no error handler:\n%s', reason.stack);
}
else
{
logger.warn('"unhandledRejection" event due to a Promise being rejected with no error handler [reason:%o]', reason);
}
}); });
logger.debug('%s version %s', PKG.name, PKG.version); logger.debug('%s version %s', PKG.name, PKG.version);
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论