Exceptions are a powerful tool in PHP and in the Zend Framework. More than just an afterthought in building your application, you need to make sure that your program not only doesn't show users ugly errors but that it properly handles all conditions. Very early on in my programming career, one of my mentors, a man named Jim Turner, told me a piece of advice that to this day I've never forgotten.
"There is no such thing as a user error. If your program let the user make a mistake then it's a system error and up to you to fix it."
Exceptions allow us to gracefully handle times when our users do things that they shouldn't, APIs from our partners don't behave as they should or generally, things happen that we didn't plan for.
Was this article helpful?