Invental/Review lessons/Code that silently does the wrong thing

Code that silently does the wrong thing

A catch that only logs lets failures through

When you move error handling into an inner function, check the outer catch: if it only logs, the failure stops propagating and everything after it runs as if nothing happened.

01 · Before and afterThe pattern

TypeScript
// before: logs failure, then carries on (later steps still run)
try { await Promise.all(steps); } catch { report('failed'); }

// after: let every parallel step finish, then fail loudly
const results = await Promise.allSettled(steps);
const bad = results.find(r => r.status === 'rejected') as PromiseRejectedResult | undefined;
if (bad) { report('failed'); throw bad.reason; }
report('succeeded');

02 · Run it on your appThe check

In your error-handling refactors, does every catch that reports a failure also rethrow or return an error?

If the honest answer is no or not sure, this is worth a look before it reaches production.

Want this checked on your code?

Tell us what you are building and what worries you. We match a senior reviewer to your code and confirm scope before anything starts.

— Get in touch
hi@invental.co ↗
— Or
— What to include

A link or short description of the code or system, what you want checked, your stack, and when you need the answer. No repository access is needed until scope is agreed.

— Or leave a note
We reply within one business day.