Skip to main content

Promise chains, error propagation and finally

What happens when then returns a value, returns a promise or throws? What does finally preserve?

Official Reference

Model Answer & Explanation

Each then returns a new promise. A returned ordinary value fulfills it, a returned promise or thenable is adopted, and a thrown error rejects it. catch can recover by returning a value or propagate by throwing. A successful finally cleanup preserves the prior outcome, but throwing or returning a rejected promise in finally replaces it.

Follow-up Interview Question · Why can forgetting return inside a then handler let the next step run too early?

Module Context & References

JavaScript · Runtime & browser theory Explain the event loop, promises, rate limiting and DOM event flow
Personal Notes · Markdown

Technologies & Interview Topics Covered

Switch between short-term interview tracks and long-term 80/20 engineering depth to practice JavaScript internals, React rendering and hooks, timed frontend machine coding UI challenges, MeetaPro FG300, Blind 75 & NeetCode 150 DSA patterns, Python & FastAPI APIs, PostgreSQL query optimization & MVCC, Redis caching, Applied AI RAG pipelines & evaluations, and distributed system design.