Ir al contenido

Unhandled Promise Rejection (ARCH3031)

Esta página aún no está disponible en tu idioma.

Key typescript.async.missing-promise-catch · Severity warning · Category async

A promise chain or awaited call with no rejection handler (.catch or a surrounding try/catch) turns a rejection into an unhandled rejection that can crash the Node process.

function refresh(): void {
fetchData().then((data) => render(data));
// no .catch - rejection is unhandled
}
function refresh(): void {
fetchData()
.then((data) => render(data))
.catch((err) => logger.error("refresh failed", err));
}

Add a .catch() to every promise chain, or wrap the await in a try/catch block.