ErrorBellFree

Error library / this error

How to fix it

Uncaught (in promise) Error

What it means

An async operation failed and nothing was waiting to catch the failure.

Common causes

  • An await or .then() with no try/catch or .catch().
  • An async function called without awaiting it.
  • A thrown error inside a promise callback.

How to fix it

1. Catch where you await

try {
  const data = await load();
} catch (err) {
  showError(err);
}

2. Do not forget to await

Calling an async function and ignoring the result hides its failure from the surrounding try/catch.

3. Add a global safety net

For reporting only, not as a replacement for handling errors:

window.addEventListener('unhandledrejection', (e) => report(e.reason));

Catch it the moment it happens

ErrorBell shows a dot on the page when this error occurs and takes you to the failing line, so you do not have to hunt through the console. Add it to Chrome, it is free.

Related errors