]> granicus.if.org Git - php/commitdiff
use new error handling when not throwing exceptions
authorRob Richards <rrichards@php.net>
Sun, 20 Feb 2005 22:01:24 +0000 (22:01 +0000)
committerRob Richards <rrichards@php.net>
Sun, 20 Feb 2005 22:01:24 +0000 (22:01 +0000)
ext/dom/domexception.c
ext/dom/php_dom.h

index 538bc682b6116c15824aa8336fefccc3178235b0..e5092a21fcc7e5a3e3079a8b1bb1d4bd470324e9 100644 (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 */
 
index a8ee2b95aaaa0fdf085994d65d5be7f07fb9dc7c..eb17dc5154c591a1f032e96347952b93739e63e8 100644 (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);