In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
我的管道在它应该失败的时候通过了,并且部署了一个在启动时崩溃的版本。如果 Node.js 以非零退出代码退出,则管道将失败并且不会部署错误版本。
有没有办法让 Node.js 在遇到未处理的 promise 拒绝时以非零退出代码退出,而不需要我等待 future ?
最佳答案
对于 node
12 及更高版本:
node --unhandled-rejections=strict
关于javascript - 我现在可以得到 future 未处理的 promise 拒绝行为吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51632965/