使用node.js,我们可以使用以下方式侦听被拒绝的承诺:
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at:', p, 'reason:', reason);
// application specific logging, throwing an error, or other logic here
});
这是在前端监听未处理的拒绝的最佳方法吗?
https://developer.mozilla.org/en-US/docs/Web/Events/unhandledrejection