Skip to content
Preptima
mediumConceptScenarioEntryMidSenior

A save button calls an API, the request fails, the error appears in the console - and the UI still shows 'Saved'. Walk me through what is actually happening in that promise chain.

A catch handler that returns normally converts a rejected promise into a fulfilled one, so every then after it runs as though nothing failed. Combined with fetch, which only rejects on network errors and resolves happily on a 500, the chain reports success twice over. Fix by re-throwing from catch, checking response.ok, and modelling UI state as a machine.

4 min readUpdated 2026-08-16Target archetype: Product Startup, Big Tech, Enterprise Captive

Answer

Short answer

catch does not stop a chain — it handles the rejection, and a handler that returns normally produces a fulfilled promise. Every .then after it therefore runs on the success path. The error was genuinely caught, genuinely logged, and then genuinely swallowed, and the chain continued as if the call had worked.

Was this answer helpful?

Likely follow-ups

  • Move the catch to the very end of the chain. Does that fix it, and what does it change about error granularity?
  • What is the difference between .then(onOk, onErr) and .then(onOk).catch(onErr)?
  • The same code written with async/await - where does this bug live there?
  • You use Promise.all for three saves and one fails. What does the user see, and what do you want them to see?
  • How would you catch this class of bug automatically rather than in review?

Related questions

Further reading