3.18. Exception Handling

Exception handling tends to be one of the more problematic aspects in software development. Not only is it hard for the developer to decide what to do when an error occurs (such as database failure, network failure, or a software bug), but it is hard to spot all the places in the code to insert checks for failure and to call the correct function to handle it. An even more complicated task is that after you handle the failure, how do you fix your program's flow to continue at a certain point in your program?

Today, most modern languages support some variant of the popular try/catch/throw exception-handling paradigm. try/catch is an enclosing language construct that protects its enclosing source codeand basically tells ...

Get PHP 5 Power Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.