简体   繁体   English

什么是process._tickCallback Node.js错误

[英]What is process._tickCallback Node.js error

Me and my friend working on project in node.js. 我和我的朋友在node.js中从事项目。 We had a error which we don't know what it is. 我们有一个错误,我们不知道它是什么。 Can you guys explain about it? 你们能解释一下吗? Here's the error: 这是错误:

at process._tickCallback (internal/process/next_tick.js:188:7)
(node:10758) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwin
g inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
 (rejection id: 2335)

PS: My friend didn't allow me to post code. PS:我的朋友不允许我发布代码。

This error happens when developers forget adding async error handling via .catch() or try... catch . 当开发人员忘记通过.catch()添加异步错误处理或try... catch时,将发生此错误。 Compare: 相比:

(async function main() {
  try {
    await Promise.reject();
  } catch (err) {
    console.error('Rejection handled.');
  }
})();
Rejection handled.
(async function main() {
  await Promise.reject();
})();
UnhandledPromiseRejectionWarning: ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM