Table of Contents
All exceptions thrown by classes in Zend Framework should extend the base class Zend_Exception.
Example 17.1. Catching an Exception
The following code listing demonstrates how to catch an exception thrown within a Zend Framework class:
try { // Calling Zend_Loader::loadClass() with a non-existant class will cause // an exception to be thrown in Zend_Loader Zend_Loader::loadClass('nonexistantclass'); } catch (Zend_Exception $e) { echo "Caught exception: " . get_class($e) . "\n"; echo "Message: " . $e->getMessage() . "\n"; // Other code to recover from the error }
The documentation for each Zend Framework component and class will contain specific information on which methods throw exceptions, the circumstances that cause an exception to be thrown, and the class of all exceptions that may be thrown.