[英]Errors not shown with babel-node
I'm not sure why, but I just ran into a situation in which an object was undefined
and I tried to call a property on that object. 我不确定为什么,但是我遇到了一种情况,即对象
undefined
,我试图在该对象上调用属性。 What happend was nothing, except that the console seems to be hanging (no more console message were printed). 除了控制台似乎挂起(没有打印任何控制台消息)外,什么都没发生。 Now, I run my ES2015 program as follows
现在,我按如下方式运行ES2015程序
$> ./node_modules/.bin/babel-node ./my-app
Is this a known issue with babel, is could this be something else ? 这是babel的已知问题吗?
You need to add an unhandledRejection
handler. 您需要添加一个
unhandledRejection
处理程序。
process.on('unhandledRejection', function(err){
console.log(err.stack);
process.exit(1);
});
otherwise Node's default Promise
implementation will silently swallow reject
calls to promises without .catch
handlers. 否则,Node的默认
Promise
实现将在没有.catch
处理程序的情况下默默地reject
对promise的调用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.