Performance and complexity
With robust failure detection and recovery in place, it's time to turn our attention to the performance and complexity implications they introduce. With any large scale JavaScript application, nothing is free—with every gain, there's a new scaling challenge. Failure handling is just one of those gains.
The two closely related scaling factors related to failure handling are performance and complexity. Our software fails in interesting ways, and there's no elegant way to handle them, resulting in complex implementations. Complex code is generally not very good for performance. So we'll start by looking at what makes our exception-handling code slow.
Exception handling
When we handle exceptions in JavaScript, we generally catch all errors that get thrown. Whether it's something we anticipate being thrown, or something that's out of the blue, it's up to the exception handler to then figure out what to do with the error. For example, does it shut the component down, or...