Can you recover from a promise rejection in JavaScript?
Yes. Return a value from .catch, and the chain continues with that value: .catch(err => 'fallback').then(result => render(result)). The .then receives 'fallback' instead of the error.
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.
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.
Still have questions?
Browse all our FAQs or reach out to our support team
