The JavaScript (and TypeScript) Error Footgun
If you’ve developed code in JavaScript or TypeScript for any length of time you’ll inevitably have encountered issues with error handling. If you haven’t here’s a simple example of what the typically error handling flow is meant to look like: try { functionThatThrows(); } catch (error) { console.error(error) } On first glance it looks pretty standard, you create a simple try-catch block and wrap your error-throwing code with it. This is the only way to handle errors for synchronous and asynchronous code in JavaScript. ...