Exceptions
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().