# Console: Uncaught (in promise) Error / TypeError / DOMException — unhandled promise rejection

**Code:** `Uncaught (in promise)` · **Category:** Browser · **Seen on:** Chrome, Firefox, JavaScript

A promise was rejected and no `.catch()` or `try/catch` handled it, so the browser logs it as an unhandled rejection.

## Meaning

The text after "Uncaught (in promise)" is the real error — often a failed `fetch`, a `TypeError`, or code that threw inside an `async` function. Add error handling at the call site, return the promise so callers can catch, and use the `unhandledrejection` event to log missed ones.

## Common causes

- `fetch` or other async call without `.catch` / `try`…`catch`
- Error thrown inside an `async` function that nobody awaits
- Rejected promise created by `Promise.reject` and ignored
- Extension or third-party script rejecting
- Missing `await` so the rejection escapes the surrounding try/catch

## Quick fix

1. Read the message after "Uncaught (in promise)" to see the real error
2. Wrap awaits in `try/catch` or add `.catch()`
3. Always `await` or `return` promises

## Detailed fix by platform

### JavaScript

1. `try { await load(); } catch (e) { console.error('load failed', e); }`
2. Global net: `window.addEventListener('unhandledrejection', e => console.error('unhandled', e.reason));`

## Code examples

### Handle async errors

```javascript
async function load() {
  const res = await fetch('/api/data');
  if (!res.ok) throw new Error('HTTP ' + res.status);
  return res.json();
}

// Not handled: load();          -> Uncaught (in promise) Error: HTTP 500
load().catch(err => console.error('load failed', err));   // handled
```

## How to diagnose

1. **Message** — What follows "Uncaught (in promise)"?
2. **Stack** — Which async call created it?
3. **Await** — Any missing await or catch?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/browser/uncaught-in-promise)
