Exceptions make it easy to interrupt program flow in the event that something goes wrong. They allow you to customize how a program handles errors, and gracefully degrades an application. This week, we will discuss various exception handling techniques, and today we will discuss the basic dos and don'ts for exceptions.
He starts with what exceptions are, how they should be used and a few handy tips that can help you make the most out of this handy PHP5 feature like:
- Exceptions are not meant to be silenced
- Use exception codes to differentiate between exceptions
- Exceptions are meant to be handled
- Don't use exceptions to manage normal program flow
- Be sure that your exceptions honor layer abstraction