Chapter 26. Making Your Application Fault-Tolerant

You can call it many things: fault-tolerant, bulletproof, robust. However you describe it, an application that doesn't shatter when things go wrong is a joy to use. These kinds of applications behave well not through luck or coding practices but because an extensive error-handling strategy was devised and applied. This chapter introduces the kinds of errors that can occur and general strategies for handling them.

Developing a Strategy

Why does your application need an error-handling strategy? Despite the best efforts of the smartest people, things always, always, always go wrong. If you do nothing to recover from errors, your program can appear to malfunction to the end user. In Chapter 24, "Errors and Exceptions," you learned that uncaught exceptions in the release versions of the Flash Player terminate all code executing on the frame. Although this might not sound so bad—at least the program keeps going on the next frame, right?—terminating all code for a frame can be disastrous, skipping vital code and leaving the internals of your program in an invalid state. Imagine if one day, without warning, you were transported forward in time a full year. You would find your taxes have not been paid; you haven't showed up to work; and you haven't answered your spouse's calls. Things would probably not be so great for you. Just like life, most programs have to finish things up in an expected way before moving forward, so you can't rely on ...

Get ActionScript 3.0 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.