1.5. Zend::exception()

Lazy loads an exception class, instantiates the exception, and returns it.

<?php

Zend::exception($class, $message, $code);

?>

The $class argument specifies the exception class to load and instantiate, and is loaded using Section 1.3, « Zend::loadClass() »; as such, it must follow the framework class naming conventions and be somewhere in the PHP include_path.

The $message and $code parameters are both optional and passed as arguments to the exception class constructor.

If successful, it loads the exception class and creates an instance using the $message and $code provided, returning the newly created exception instance. If unable to load the class or if the class does not extend Exception, it throws an exception.