开玩笑的承诺:triggerUncaughtException(err, true /* fromPromise */)

pmi*_*nda 5 es6-promise jestjs

我在运行所有测试时遇到此错误(当我直接加载所涉及的函数的唯一测试时,没有错误)

\n
node:internal/process/promises:246\n      triggerUncaughtException(err, true /* fromPromise */);\n      ^\n\n[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block,\nor by rejecting a promise which was not handled with .catch(). The promise rejected with the reason\n"Error: Ha ocurrido un error, por favor intente de nuevo m\xc3\xa1s tarde".] {\n  code: 'ERR_UNHANDLED_REJECTION'\n}\n
Run Code Online (Sandbox Code Playgroud)\n

生成错误的函数的代码块如下所示:

\n
async getMonthRequests(rut, month) {\n  try {\n    // some code, in the test I'm testing that it fails\n  } catch (error) {\n    return Promise.reject('Ha ocurrido un error, por favor intente de nuevo m\xc3\xa1s tarde');\n  }\n}\n
Run Code Online (Sandbox Code Playgroud)\n

任何想法?

\n

小智 0

创建连接时检查 amqp 服务器的主机和端口。

amqp://localhost:5672
Run Code Online (Sandbox Code Playgroud)