To find the source of errors, good error handling should be implemented. In this recipe we'll talk about Exception handling within the Zend Framework 2 and how to optimally use it.
We can safely assume that we all know about try-catch and Exceptions, but to make sure nobody is caught out please take a look at the link to the PHP manual in the See also subsection in this section.
Exception handling is not that difficult to use, but it is a very useful tool if used correctly.
Let's take a look at the following example:
<?php // This non existing method throws a couple of Exception, which // is a PDOException, BadMethodCallException and probably ...