in reply to Die vs. Exit

A really good way to handle a lot of things is to put an exception-catching statement around every, say, user-interface driven section of your program. Anywhere within that section, the logic can throw an exception by means of die, and, no matter where it is when it does so, control will immediately pass to the (innermost) exception handler. Notice that die can throw strings or objects. You could, for example, display a dialog-box containing the text of an error-string that was part of the exception that was caught. The logic of the program is simplified because, "if you made it to the end, then it worked." And, "if you made it to the exception handler, it didn't work." It doesn't matter how deep-down in the logic of the application you were when you threw the exception: poof... you are now in the exception handler.