📌  相关文章
📜  (节点:3868)UnhandledPromiseRejectionWarning:错误:您必须调用` - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:50.383000             🧑  作者: Mango

代码示例1
new Promise((resolve, reject) => {
  setTimeout(() => reject('woops'), 500);
});

/* Output:
$ node test.js
(node:8128) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): woops
(node:8128) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. */