Better Error Handling
Published on: 2025-08-18 20:13:19
Bad error handling has cost billions of dollars, crashed planes, killed people, tanked stock markets, wrecked vehicles, and delayed flights. As we reflect on Halloween, it’s fitting to consider these horror stories of software gone wrong. You can read more about them in my A Halloween scary story, based on true events, or watch this newly minted Fireship video.
Thank God I didn’t fly during the CrowStrike incident (see what I did there?).
Error handling isn’t just a technical challenge - it’s a critical aspect of software safety and reliability. Yet in TypeScript and JavaScript, it remains something of a wild west. Today, I’ll share an overview of the current landscape and my preferred approaches.
The Current State of Error Handling
The most common approach is the traditional try/catch method. Everyone is familiar with its basic syntax, which works similarly for both synchronous and asynchronous code:
async function fetchUserDataBasic ( userId : number ) : Promise < UserData > { t
... Read full article.