How does error propagation work in promise chains in JavaScript?
If a .then callback throws, the error skips subsequent .then callbacks and propagates to the next .catch. If there is no .catch, the error becomes an unhandled rejection. After .catch, the chain continues with the value returned by .catch.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Promise .then, .catch, and .finally Explained
.then runs when the promise fulfills (receives the value). .catch runs when the promise rejects or a .then throws (receives the error). .finally runs when the promise settles, regardless of outcome (no value or error received).
Yes. Each .then (and .catch and .finally) returns a new promise. If the callback returns a value, the new promise fulfills with that value. If it returns a promise, the new promise waits for it. This enables chaining.
No. .finally does not receive the value or error. It runs for cleanup (hiding spinners, closing connections). The promise returned by .finally passes through the original value or error.
Still have questions?
Browse all our FAQs or reach out to our support team
