AeonGUI
A portable video game graphic user interface library.
Loading...
Searching...
No Matches
DOMException.hpp
1/*
2Copyright (C) 2025,2026 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16#ifndef AEONGUI_DOMEXCEPTION_HPP
17#define AEONGUI_DOMEXCEPTION_HPP
18#include <exception>
19#include "aeongui/Platform.hpp"
20#include "DOMString.hpp"
21namespace AeonGUI
22{
23 namespace DOM
24 {
31 class DOMException : public std::exception
32 {
33 public:
35 enum ExceptionCode : unsigned short
36 {
37 INDEX_SIZE_ERR = 1,
38 DOMSTRING_SIZE_ERR = 2,
39 HIERARCHY_REQUEST_ERR = 3,
40 WRONG_DOCUMENT_ERR = 4,
41 INVALID_CHARACTER_ERR = 5,
42 NO_DATA_ALLOWED_ERR = 6,
43 NO_MODIFICATION_ALLOWED_ERR = 7,
44 NOT_FOUND_ERR = 8,
45 NOT_SUPPORTED_ERR = 9,
46 INUSE_ATTRIBUTE_ERR = 10,
47 INVALID_STATE_ERR = 11,
48 SYNTAX_ERR = 12,
49 INVALID_MODIFICATION_ERR = 13,
50 NAMESPACE_ERR = 14,
51 INVALID_ACCESS_ERR = 15,
52 VALIDATION_ERR = 16,
53 TYPE_MISMATCH_ERR = 17,
54 SECURITY_ERR = 18,
55 NETWORK_ERR = 19,
56 ABORT_ERR = 20,
57 URL_MISMATCH_ERR = 21,
58 QUOTA_EXCEEDED_ERR = 22,
59 TIMEOUT_ERR = 23,
60 INVALID_NODE_TYPE_ERR = 24,
61 DATA_CLONE_ERR = 25
62 };
63
66 const char* what() const noexcept override
67 {
68 return mName.c_str();
69 }
70
73 const DOMString& message() const
74 {
75 return mMessage;
76 }
77
80 const DOMString& name() const
81 {
82 return mName;
83 }
84
87 unsigned short code() const
88 {
89 return mCode;
90 }
91 protected:
97 DOMException ( unsigned short code, const DOMString& message = "", const DOMString& name = "Error" ) : mMessage ( message ), mName ( name ), mCode ( code ) {}
98 virtual ~DOMException() = default;
99 DOMString mMessage{};
100 DOMString mName{"Error"};
101 unsigned short mCode{ 0 };
102 };
103
106 {
107 public:
112 DOMIndexSizeError ( const DOMString& message = "", const DOMString& name = "Index size error" ) : DOMException ( DOMException::INDEX_SIZE_ERR, message, name ) {}
113 virtual ~DOMIndexSizeError() = default;
114 };
115
118 {
119 public:
124 DOMStringSizeError ( const DOMString& message = "", const DOMString& name = "DOM string size error" ) : DOMException ( DOMException::DOMSTRING_SIZE_ERR, message, name ) {}
125 virtual ~DOMStringSizeError() = default;
126 };
127
130 {
131 public:
136 DOMHierarchyRequestError ( const DOMString& message = "", const DOMString& name = "Hierarchy request error" ) : DOMException ( DOMException::HIERARCHY_REQUEST_ERR, message, name ) {}
137 virtual ~DOMHierarchyRequestError() = default;
138 };
139
142 {
143 public:
148 DOMWrongDocumentError ( const DOMString& message = "", const DOMString& name = "Wrong document error" ) : DOMException ( DOMException::WRONG_DOCUMENT_ERR, message, name ) {}
149 virtual ~DOMWrongDocumentError() = default;
150 };
151
154 {
155 public:
160 DOMInvalidCharacterError ( const DOMString& message = "", const DOMString& name = "Invalid character error" ) : DOMException ( DOMException::INVALID_CHARACTER_ERR, message, name ) {}
161 virtual ~DOMInvalidCharacterError() = default;
162 };
163
166 {
167 public:
172 DOMNoDataAllowedError ( const DOMString& message = "", const DOMString& name = "No data allowed error" ) : DOMException ( DOMException::NO_DATA_ALLOWED_ERR, message, name ) {}
173 virtual ~DOMNoDataAllowedError() = default;
174 };
175
178 {
179 public:
184 DOMNoModificationAllowedError ( const DOMString& message = "", const DOMString& name = "No modification allowed error" ) : DOMException ( DOMException::NO_MODIFICATION_ALLOWED_ERR, message, name ) {}
185 virtual ~DOMNoModificationAllowedError() = default;
186 };
187
190 {
191 public:
196 DOMNotFoundError ( const DOMString& message = "", const DOMString& name = "Not found error" ) : DOMException ( DOMException::NOT_FOUND_ERR, message, name ) {}
197 virtual ~DOMNotFoundError() = default;
198 };
199
202 {
203 public:
208 DOMNotSupportedError ( const DOMString& message = "", const DOMString& name = "Not supported error" ) : DOMException ( DOMException::NOT_SUPPORTED_ERR, message, name ) {}
209 virtual ~DOMNotSupportedError() = default;
210 };
211
214 {
215 public:
220 DOMInUseAttributeError ( const DOMString& message = "", const DOMString& name = "In use attribute error" ) : DOMException ( DOMException::INUSE_ATTRIBUTE_ERR, message, name ) {}
221 virtual ~DOMInUseAttributeError() = default;
222 };
223
226 {
227 public:
232 DOMInvalidStateError ( const DOMString& message = "", const DOMString& name = "Invalid state error" ) : DOMException ( DOMException::INVALID_STATE_ERR, message, name ) {}
233 virtual ~DOMInvalidStateError() = default;
234 };
235
238 {
239 public:
244 DOMSyntaxError ( const DOMString& message = "", const DOMString& name = "Syntax error" ) : DOMException ( DOMException::SYNTAX_ERR, message, name ) {}
245 virtual ~DOMSyntaxError() = default;
246 };
247
250 {
251 public:
256 DOMInvalidModificationError ( const DOMString& message = "", const DOMString& name = "Invalid modification error" ) : DOMException ( DOMException::INVALID_MODIFICATION_ERR, message, name ) {}
257 virtual ~DOMInvalidModificationError() = default;
258 };
259
262 {
263 public:
268 DOMNamespaceError ( const DOMString& message = "", const DOMString& name = "Namespace error" ) : DOMException ( DOMException::NAMESPACE_ERR, message, name ) {}
269 virtual ~DOMNamespaceError() = default;
270 };
271
274 {
275 public:
280 DOMInvalidAccessError ( const DOMString& message = "", const DOMString& name = "Invalid access error" ) : DOMException ( DOMException::INVALID_ACCESS_ERR, message, name ) {}
281 virtual ~DOMInvalidAccessError() = default;
282 };
283
286 {
287 public:
292 DOMValidationError ( const DOMString& message = "", const DOMString& name = "Validation error" ) : DOMException ( DOMException::VALIDATION_ERR, message, name ) {}
293 virtual ~DOMValidationError() = default;
294 };
295
298 {
299 public:
304 DOMTypeMismatchError ( const DOMString& message = "", const DOMString& name = "Type mismatch error" ) : DOMException ( DOMException::TYPE_MISMATCH_ERR, message, name ) {}
305 virtual ~DOMTypeMismatchError() = default;
306 };
307
310 {
311 public:
316 DOMSecurityError ( const DOMString& message = "", const DOMString& name = "Security error" ) : DOMException ( DOMException::SECURITY_ERR, message, name ) {}
317 virtual ~DOMSecurityError() = default;
318 };
319
321 {
322 public:
327 DOMNetworkError ( const DOMString& message = "", const DOMString& name = "Network error" ) : DOMException ( DOMException::NETWORK_ERR, message, name ) {}
328 virtual ~DOMNetworkError() = default;
329 };
330
332 {
333 public:
338 DOMAbortError ( const DOMString& message = "", const DOMString& name = "Abort error" ) : DOMException ( DOMException::ABORT_ERR, message, name ) {}
339 virtual ~DOMAbortError() = default;
340 };
341
344 {
345 public:
350 DOMUrlMismatchError ( const DOMString& message = "", const DOMString& name = "URL mismatch error" ) : DOMException ( DOMException::URL_MISMATCH_ERR, message, name ) {}
351 virtual ~DOMUrlMismatchError() = default;
352 };
353
356 {
357 public:
362 DOMQuotaExceededError ( const DOMString& message = "", const DOMString& name = "Quota exceeded error" ) : DOMException ( DOMException::QUOTA_EXCEEDED_ERR, message, name ) {}
363 virtual ~DOMQuotaExceededError() = default;
364 };
365
368 {
369 public:
374 DOMTimeoutError ( const DOMString& message = "", const DOMString& name = "Timeout error" ) : DOMException ( DOMException::TIMEOUT_ERR, message, name ) {}
375 virtual ~DOMTimeoutError() = default;
376 };
377
380 {
381 public:
386 DOMInvalidNodeTypeError ( const DOMString& message = "", const DOMString& name = "Invalid node type error" ) : DOMException ( DOMException::INVALID_NODE_TYPE_ERR, message, name ) {}
387 virtual ~DOMInvalidNodeTypeError() = default;
388 };
389
392 {
393 public:
398 DOMDataCloneError ( const DOMString& message = "", const DOMString& name = "Data clone error" ) : DOMException ( DOMException::DATA_CLONE_ERR, message, name ) {}
399 virtual ~DOMDataCloneError() = default;
400 };
401 }
402}
403
404#endif
Platform-specific DLL import/export macros and compiler helpers.
Thrown when an operation is aborted.
Definition DOMException.hpp:332
DOMAbortError(const DOMString &message="", const DOMString &name="Abort error")
Construct a DOMAbortError.
Definition DOMException.hpp:338
Thrown when data cannot be cloned.
Definition DOMException.hpp:392
DOMDataCloneError(const DOMString &message="", const DOMString &name="Data clone error")
Construct a DOMDataCloneError.
Definition DOMException.hpp:398
Base class for all DOM exceptions.
Definition DOMException.hpp:32
unsigned short code() const
Get the numeric exception code.
Definition DOMException.hpp:87
unsigned short mCode
The numeric error code.
Definition DOMException.hpp:101
DOMString mMessage
The error message.
Definition DOMException.hpp:99
const DOMString & name() const
Get the error name.
Definition DOMException.hpp:80
DOMException(unsigned short code, const DOMString &message="", const DOMString &name="Error")
Construct a DOMException.
Definition DOMException.hpp:97
const char * what() const noexcept override
Get the human-readable error name.
Definition DOMException.hpp:66
ExceptionCode
W3C DOM exception codes.
Definition DOMException.hpp:36
DOMString mName
The error name.
Definition DOMException.hpp:100
const DOMString & message() const
Get the error message.
Definition DOMException.hpp:73
Thrown when a node is inserted into an invalid position.
Definition DOMException.hpp:130
DOMHierarchyRequestError(const DOMString &message="", const DOMString &name="Hierarchy request error")
Construct a DOMHierarchyRequestError.
Definition DOMException.hpp:136
Thrown when an attribute is already in use.
Definition DOMException.hpp:214
DOMInUseAttributeError(const DOMString &message="", const DOMString &name="In use attribute error")
Construct a DOMInUseAttributeError.
Definition DOMException.hpp:220
Thrown when an index is out of range.
Definition DOMException.hpp:106
DOMIndexSizeError(const DOMString &message="", const DOMString &name="Index size error")
Construct a DOMIndexSizeError.
Definition DOMException.hpp:112
Thrown when access to an object is denied.
Definition DOMException.hpp:274
DOMInvalidAccessError(const DOMString &message="", const DOMString &name="Invalid access error")
Construct a DOMInvalidAccessError.
Definition DOMException.hpp:280
Thrown when an invalid or illegal character is specified.
Definition DOMException.hpp:154
DOMInvalidCharacterError(const DOMString &message="", const DOMString &name="Invalid character error")
Construct a DOMInvalidCharacterError.
Definition DOMException.hpp:160
Thrown when an invalid modification is attempted.
Definition DOMException.hpp:250
DOMInvalidModificationError(const DOMString &message="", const DOMString &name="Invalid modification error")
Construct a DOMInvalidModificationError.
Definition DOMException.hpp:256
Thrown when an invalid node type is used.
Definition DOMException.hpp:380
DOMInvalidNodeTypeError(const DOMString &message="", const DOMString &name="Invalid node type error")
Construct a DOMInvalidNodeTypeError.
Definition DOMException.hpp:386
Thrown when an object is in an invalid state.
Definition DOMException.hpp:226
DOMInvalidStateError(const DOMString &message="", const DOMString &name="Invalid state error")
Construct a DOMInvalidStateError.
Definition DOMException.hpp:232
Thrown on a namespace error.
Definition DOMException.hpp:262
DOMNamespaceError(const DOMString &message="", const DOMString &name="Namespace error")
Construct a DOMNamespaceError.
Definition DOMException.hpp:268
Thrown on a network error.
Definition DOMException.hpp:321
DOMNetworkError(const DOMString &message="", const DOMString &name="Network error")
Construct a DOMNetworkError.
Definition DOMException.hpp:327
Thrown when data is specified for a node that does not support it.
Definition DOMException.hpp:166
DOMNoDataAllowedError(const DOMString &message="", const DOMString &name="No data allowed error")
Construct a DOMNoDataAllowedError.
Definition DOMException.hpp:172
Thrown when a modification is not allowed.
Definition DOMException.hpp:178
DOMNoModificationAllowedError(const DOMString &message="", const DOMString &name="No modification allowed error")
Construct a DOMNoModificationAllowedError.
Definition DOMException.hpp:184
Thrown when a referenced node does not exist.
Definition DOMException.hpp:190
DOMNotFoundError(const DOMString &message="", const DOMString &name="Not found error")
Construct a DOMNotFoundError.
Definition DOMException.hpp:196
Thrown when a requested operation is not supported.
Definition DOMException.hpp:202
DOMNotSupportedError(const DOMString &message="", const DOMString &name="Not supported error")
Construct a DOMNotSupportedError.
Definition DOMException.hpp:208
Thrown when a storage quota is exceeded.
Definition DOMException.hpp:356
DOMQuotaExceededError(const DOMString &message="", const DOMString &name="Quota exceeded error")
Construct a DOMQuotaExceededError.
Definition DOMException.hpp:362
Thrown on a security violation.
Definition DOMException.hpp:310
DOMSecurityError(const DOMString &message="", const DOMString &name="Security error")
Construct a DOMSecurityError.
Definition DOMException.hpp:316
Thrown when a DOMString exceeds implementation limits.
Definition DOMException.hpp:118
DOMStringSizeError(const DOMString &message="", const DOMString &name="DOM string size error")
Construct a DOMStringSizeError.
Definition DOMException.hpp:124
Thrown when a string does not match expected syntax.
Definition DOMException.hpp:238
DOMSyntaxError(const DOMString &message="", const DOMString &name="Syntax error")
Construct a DOMSyntaxError.
Definition DOMException.hpp:244
Thrown when an operation times out.
Definition DOMException.hpp:368
DOMTimeoutError(const DOMString &message="", const DOMString &name="Timeout error")
Construct a DOMTimeoutError.
Definition DOMException.hpp:374
Thrown on a type mismatch.
Definition DOMException.hpp:298
DOMTypeMismatchError(const DOMString &message="", const DOMString &name="Type mismatch error")
Construct a DOMTypeMismatchError.
Definition DOMException.hpp:304
Thrown when a URL does not match expectations.
Definition DOMException.hpp:344
DOMUrlMismatchError(const DOMString &message="", const DOMString &name="URL mismatch error")
Construct a DOMUrlMismatchError.
Definition DOMException.hpp:350
Thrown when validation fails.
Definition DOMException.hpp:286
DOMValidationError(const DOMString &message="", const DOMString &name="Validation error")
Construct a DOMValidationError.
Definition DOMException.hpp:292
Thrown when a node is used in a different document.
Definition DOMException.hpp:142
DOMWrongDocumentError(const DOMString &message="", const DOMString &name="Wrong document error")
Construct a DOMWrongDocumentError.
Definition DOMException.hpp:148