1 /* 2 * This file is part of the DOM implementation for KDE. 3 * 4 * Copyright 1999 Lars Knoll (knoll@kde.org) 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Library General Public 8 * License as published by the Free Software Foundation; either 9 * version 2 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Library General Public License for more details. 15 * 16 * You should have received a copy of the GNU Library General Public License 17 * along with this library; see the file COPYING.LIB. If not, write to 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA. 20 * 21 * This file includes excerpts from the Document Object Model (DOM) 22 * Level 1 Specification (Recommendation) 23 * https://www.w3.org/TR/REC-DOM-Level-1/ 24 * Copyright © World Wide Web Consortium , (Massachusetts Institute of 25 * Technology , Institut National de Recherche en Informatique et en 26 * Automatique , Keio University ). All Rights Reserved. 27 * 28 */ 29 #ifndef _DOM_DOMException_h_ 30 #define _DOM_DOMException_h_ 31 32 #include <dom/dom_misc.h> 33 #include <dom/dom_string.h> 34 35 namespace DOM 36 { 37 38 /** 39 * DOM operations only raise exceptions in "exceptional" 40 * circumstances, i.e., when an operation is impossible to perform 41 * (either for logical reasons, because data is lost, or because the 42 * implementation has become unstable). In general, DOM methods return 43 * specific error values in ordinary processing situation, such as 44 * out-of-bound errors when using \c NodeList . 45 * 46 * Implementations may raise other exceptions under other 47 * circumstances. For example, implementations may raise an 48 * implementation-dependent exception if a \c null 49 * argument is passed. 50 * 51 * Some languages and object systems do not support the concept of 52 * exceptions. For such systems, error conditions may be indicated 53 * using native error reporting mechanisms. For some bindings, for 54 * example, methods may return error codes similar to those listed in 55 * the corresponding method descriptions. 56 * 57 */ 58 class KHTML_EXPORT DOMException 59 { 60 public: DOMException(unsigned short _code)61 DOMException(unsigned short _code) 62 { 63 code = _code; 64 } DOMException(const DOMException & other)65 DOMException(const DOMException &other) 66 { 67 code = other.code; 68 } 69 70 DOMException &operator = (const DOMException &other) 71 { 72 code = other.code; 73 return *this; 74 } 75 ~DOMException()76 virtual ~DOMException() {} 77 /** 78 * An integer indicating the type of error generated. 79 * 80 */ 81 enum ExceptionCode { 82 INDEX_SIZE_ERR = 1, 83 DOMSTRING_SIZE_ERR = 2, 84 HIERARCHY_REQUEST_ERR = 3, 85 WRONG_DOCUMENT_ERR = 4, 86 INVALID_CHARACTER_ERR = 5, 87 NO_DATA_ALLOWED_ERR = 6, 88 NO_MODIFICATION_ALLOWED_ERR = 7, 89 NOT_FOUND_ERR = 8, 90 NOT_SUPPORTED_ERR = 9, 91 INUSE_ATTRIBUTE_ERR = 10, 92 INVALID_STATE_ERR = 11, 93 SYNTAX_ERR = 12, 94 INVALID_MODIFICATION_ERR = 13, 95 NAMESPACE_ERR = 14, 96 INVALID_ACCESS_ERR = 15, 97 VALIDATION_ERR = 16, 98 TYPE_MISMATCH_ERR = 17, 99 SECURITY_ERR = 18, 100 NETWORK_ERR = 19, ///< @since 4.5.2 101 ABORT_ERR = 20, ///< @since 4.5.2 102 URL_MISMATCH_ERR = 21, ///< @since 4.5.2 103 QUOTA_EXCEEDED_ERR = 22, ///< @since 4.5.2 104 TIMEOUT_ERR = 23, ///< @since 4.5.2 105 NOT_READABLE_ERR = 24, ///< @since 4.5.2 106 DATA_CLONE_ERR = 25, ///< @since 4.5.2 107 ENCODING_ERR = 26 ///< @since 4.5.2 108 }; 109 unsigned short code; 110 111 /// Returns the name of this error 112 DOMString codeAsString() const; 113 114 /// Returns the name of given error code 115 static DOMString codeAsString(int code); 116 117 /** @internal - checks to see whether internal code is a DOMException one */ 118 static bool isDOMExceptionCode(int exceptioncode); 119 120 }; 121 122 } //namespace 123 #endif 124