php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
domexception.c
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Copyright (c) The PHP Group |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.01 of the PHP license, |
6 | that is bundled with this package in the file LICENSE, and is |
7 | available through the world-wide-web at the following url: |
8 | https://www.php.net/license/3_01.txt |
9 | If you did not receive a copy of the PHP license and are unable to |
10 | obtain it through the world-wide-web, please send a note to |
11 | license@php.net so we can mail you a copy immediately. |
12 +----------------------------------------------------------------------+
13 | Authors: Christian Stocker <chregu@php.net> |
14 | Rob Richards <rrichards@php.net> |
15 +----------------------------------------------------------------------+
16*/
17
18#ifdef HAVE_CONFIG_H
19#include <config.h>
20#endif
21
22#include "php.h"
23#if defined(HAVE_LIBXML) && defined(HAVE_DOM)
24#include "php_dom.h"
25
26/*
27* class DOMException
28*
29* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-17189187
30* Since:
31*/
32
33void php_dom_throw_error_with_message(dom_exception_code error_code, const char *error_message, bool strict_error) /* {{{ */
34{
35 if (strict_error) {
37 } else {
38 php_libxml_issue_error(E_WARNING, error_message);
39 }
40}
41/* }}} */
42
43/* {{{ php_dom_throw_error */
45{
46 const char *error_message;
47
48 switch (error_code)
49 {
50 case INDEX_SIZE_ERR:
51 error_message = "Index Size Error";
52 break;
54 error_message = "DOM String Size Error";
55 break;
57 error_message = "Hierarchy Request Error";
58 break;
60 error_message = "Wrong Document Error";
61 break;
63 error_message = "Invalid Character Error";
64 break;
66 error_message = "No Data Allowed Error";
67 break;
69 error_message = "No Modification Allowed Error";
70 break;
71 case NOT_FOUND_ERR:
72 error_message = "Not Found Error";
73 break;
75 error_message = "Not Supported Error";
76 break;
78 error_message = "Inuse Attribute Error";
79 break;
81 error_message = "Invalid State Error";
82 break;
83 case SYNTAX_ERR:
84 error_message = "Syntax Error";
85 break;
87 error_message = "Invalid Modification Error";
88 break;
89 case NAMESPACE_ERR:
90 error_message = "Namespace Error";
91 break;
93 error_message = "Invalid Access Error";
94 break;
95 case VALIDATION_ERR:
96 error_message = "Validation Error";
97 break;
98 default:
99 error_message = "Unhandled Error";
100 }
101
102 php_dom_throw_error_with_message(error_code, error_message, strict_error);
103}
104/* }}} end php_dom_throw_error */
105
106#endif /* HAVE_LIBXML && HAVE_DOM */
PHP_DOM_EXPORT zend_class_entry * dom_domexception_class_entry
void php_dom_throw_error_with_message(dom_exception_code error_code, const char *error_message, bool strict_error)
void php_dom_throw_error(dom_exception_code error_code, bool strict_error)
dom_exception_code
@ NO_MODIFICATION_ALLOWED_ERR
@ INVALID_STATE_ERR
@ NOT_FOUND_ERR
@ HIERARCHY_REQUEST_ERR
@ INVALID_ACCESS_ERR
@ INVALID_MODIFICATION_ERR
@ INUSE_ATTRIBUTE_ERR
@ NAMESPACE_ERR
@ NOT_SUPPORTED_ERR
@ NO_DATA_ALLOWED_ERR
@ INDEX_SIZE_ERR
@ INVALID_CHARACTER_ERR
@ SYNTAX_ERR
@ WRONG_DOCUMENT_ERR
@ DOMSTRING_SIZE_ERR
@ VALIDATION_ERR
php_json_error_code error_code
Definition php_json.h:92
#define E_WARNING
Definition zend_errors.h:24
ZEND_API ZEND_COLD zend_object * zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code)