use new error handling when not throwing exceptions

This commit is contained in:
Rob Richards 2005-02-20 22:01:24 +00:00
parent b7cf6f4539
commit 8913ddc295
2 changed files with 12 additions and 5 deletions

View File

@ -41,6 +41,16 @@ zend_function_entry php_dom_domexception_class_functions[] = {
{NULL, NULL, NULL}
};
/* {{{ php_dom_throw_error_with_message */
void php_dom_throw_error_with_message(int error_code, char *error_message, int strict_error TSRMLS_DC)
{
if (strict_error == 1) {
zend_throw_exception(dom_domexception_class_entry, error_message, error_code TSRMLS_CC);
} else {
php_libxml_issue_error(E_WARNING, error_message TSRMLS_CC);
}
}
/* {{{ php_dom_throw_error */
void php_dom_throw_error(int error_code, int strict_error TSRMLS_DC)
{
@ -100,11 +110,7 @@ void php_dom_throw_error(int error_code, int strict_error TSRMLS_DC)
error_message = "Unhandled Error";
}
if (strict_error == 1) {
zend_throw_exception(dom_domexception_class_entry, error_message, error_code TSRMLS_CC);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", error_message);
}
php_dom_throw_error_with_message(error_code, error_message, strict_error TSRMLS_CC);
}
/* }}} end php_dom_throw_error */

View File

@ -91,6 +91,7 @@ zend_object_value dom_xpath_objects_new(zend_class_entry *class_type TSRMLS_DC);
#endif
int dom_get_strict_error(php_libxml_ref_obj *document);
void php_dom_throw_error(int error_code, int strict_error TSRMLS_DC);
void php_dom_throw_error_with_message(int error_code, char *error_message, int strict_error TSRMLS_DC);
void node_list_unlink(xmlNodePtr node TSRMLS_DC);
int dom_check_qname(char *qname, char **localname, char **prefix, int uri_len, int name_len);
xmlNsPtr dom_get_ns(xmlNodePtr node, char *uri, int *errorcode, char *prefix);