Unhandled Promise Rejection (ARCH3031)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
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.
Incorrect
Section titled “Incorrect”function refresh(): void { fetchData().then((data) => render(data)); // no .catch - rejection is unhandled}Correct
Section titled “Correct”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.