Course contentsShow
← JavaScript
Lesson 1284 of 2,72329. PromisesFree lesson

Error Propagation in Promise Chains

Learn how uncaught rejections propagate down the chain until a .catch() handler or chain end is reached.

Error Propagation in Promise Chains

What you'll learn: How uncaught rejections automatically propagate down a promise chain until they're handled by a .catch() or reach the end.

The Core Idea

When a promise in a chain rejects and there's no .catch() immediately following it, the rejection doesn't just disappear—it propagates forward through the chain, skipping over all subsequent .then() handlers until it finds a .catch() that can handle it. If no .catch() exists, the error reaches the end of the chain unhandled.

Think of it like a hot potato being passed down a line of people: each .then() refuses to touch the error and tosses it forward. Only a .catch() is willing to grab it.

How It Works

Promise.reject('Something broke!')
  .then(() => {
    console.log('This will NOT run');
    return 'Step 1';
  })
  .then(() => {
    console.log('This will NOT run either');
    return 'Step 2';
  })
  .catch(err => {
    console.log('Caught:', err); // 'Caught: Something broke!'
  });

The rejection skips both .then() handlers and jumps straight to .catch(). Every .then() in between is bypassed.

If an error occurs mid-chain, the same propagation happens:

Promise.resolve('start')
  .then(() => {
    throw new Error('Oops!');
  })
  .then(() => {
    console.log('Skipped');
  })
  .catch(err => {
    console.log('Caught:', err.message); // 'Caught: Oops!'
  });

The error from the first .then() propagates down, skipping the second .then() entirely.

Key Takeaway:
Rejections in promise chains automatically propagate forward, bypassing all .then() handlers until reaching a .catch() or the chain's end—ensuring errors don't silently vanish mid-chain.