zval * zend_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC); zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, char *format, ...); zval * zend_throw_error_exception(zend_class_entry *exception_ce, char *message, long code, int severity TSRMLS_DC); void zend_throw_exception_object(zval *exception_obj TSRMLS_DC);
Throws an exception similar to calling using the throw keyword from userspace. Calling this function from internals does not immediately resume script execution at the next catch block, meaning that additional post-throw processing might be done. After your internal function returns control to the executor however, the catch will be processed.
Argument |
Purpose |
---|---|
exception_ce |
Type of exception to throw given as a class entry. Typically this will be passed using one of zend_exception_get_default() or zend_get_error_exception(). |
exception_obj |
A prepared exception object descended from the Exception class. |
code |
Numeric exception code; returned by $e->getCode();. |
severity |
Specific to the error exception class; returned by its $e->getSeverity(); method. |
message |
Simple NULL-terminated message. |
format |
sprintf-style format argument used with subsequent variable argument list. |
... |
Variable argument list containing data corresponding to the sprintf style format specifier. |
zend_class_entry *zend_exception_get_default(void); zend_class_entry *zend_get_error_exception(void);
Returns the class entries for exception classes defined by the engine. ErrorException is a child of the default Exception class used by zend_throw_error_exception().
The PHP Life Cycle
Variables from the Inside Out
Memory Management
Setting Up a Build Environment
Your First Extension
Returning Values
Accepting Parameters
Working with Arrays and HashTables
The Resource Data Type
PHP4 Objects
PHP5 Objects
Startup, Shutdown, and a Few Points in Between
INI Settings
Accessing Streams
Implementing Streams
Diverting the Stream
Configuration and Linking
Extension Generators
Setting Up a Host Environment
Advanced Embedding
Appendix A. A Zend API Reference
Appendix B. PHPAPI
Appendix C. Extending and Embedding Cookbook
Appendix D. Additional Resources