1.5. Zend::exception()

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

[Note] Deprecated:

This method was introduced in Zend Framework 0.6.0. It was recently decided that it's better to use traditional methods to instantiate, throw, and catch exceptions. The Zend::exception() method is deprecated in Zend Framework 0.6.1, and it will be removed from the Zend Framework product in a later Preview Release.

<?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.