• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3  *
4  *  This library is free software; you can redistribute it and/or
5  *  modify it under the terms of the GNU Lesser General Public
6  *  License as published by the Free Software Foundation; either
7  *  version 2 of the License, or (at your option) any later version.
8  *
9  *  This library is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  *  Lesser General Public License for more details.
13  *
14  *  You should have received a copy of the GNU Lesser General Public
15  *  License along with this library; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18 
19 #ifndef ExceptionCode_h
20 #define ExceptionCode_h
21 
22 namespace WebCore {
23 
24     // The DOM standards use unsigned short for exception codes.
25     // In our DOM implementation we use int instead, and use different
26     // numerical ranges for different types of DOM exception, so that
27     // an exception of any type can be expressed with a single integer.
28     typedef int ExceptionCode;
29 
30     enum {
31         INDEX_SIZE_ERR = 1,
32         DOMSTRING_SIZE_ERR = 2,
33         HIERARCHY_REQUEST_ERR = 3,
34         WRONG_DOCUMENT_ERR = 4,
35         INVALID_CHARACTER_ERR = 5,
36         NO_DATA_ALLOWED_ERR = 6,
37         NO_MODIFICATION_ALLOWED_ERR = 7,
38         NOT_FOUND_ERR = 8,
39         NOT_SUPPORTED_ERR = 9,
40         INUSE_ATTRIBUTE_ERR = 10,
41 
42         // Introduced in DOM Level 2:
43         INVALID_STATE_ERR = 11,
44         SYNTAX_ERR = 12,
45         INVALID_MODIFICATION_ERR = 13,
46         NAMESPACE_ERR = 14,
47         INVALID_ACCESS_ERR = 15,
48 
49         // Introduced in DOM Level 3:
50         VALIDATION_ERR = 16,
51         TYPE_MISMATCH_ERR = 17,
52 
53         // XMLHttpRequest extension:
54         SECURITY_ERR = 18,
55 
56         // Others introduced in HTML5:
57         NETWORK_ERR = 19,
58         ABORT_ERR = 20,
59         URL_MISMATCH_ERR = 21,
60         QUOTA_EXCEEDED_ERR = 22
61 
62         // Introduced in File API:
63         // http://www.w3.org/TR/file-upload/#dfn-fileerror
64 #if ENABLE(BLOB) || ENABLE(FILE_SYSTEM)
65         , NOT_READABLE_ERR = 24
66         , ENCODING_ERR = 26
67 #endif
68     };
69 
70     enum ExceptionType {
71         DOMExceptionType,
72         RangeExceptionType,
73         EventExceptionType,
74         XMLHttpRequestExceptionType
75 #if ENABLE(XPATH)
76         , XPathExceptionType
77 #endif
78 #if ENABLE(SVG)
79         , SVGExceptionType
80 #endif
81 #if ENABLE(DATABASE)
82         , SQLExceptionType
83 #endif
84 #if ENABLE(BLOB) || ENABLE(FILE_SYSTEM)
85         , FileExceptionType
86 #endif
87 #if ENABLE(INDEXED_DATABASE)
88         , IDBDatabaseExceptionType
89 #endif
90     };
91 
92 
93     struct ExceptionCodeDescription {
94         const char* typeName; // has spaces and is suitable for use in exception description strings; maximum length is 10 characters
95         const char* name; // exception name, also intended for use in exception description strings; 0 if name not known; maximum length is 27 characters
96         const char* description; // exception description, intended for use in exception strings; more readable explanation of error
97         int code; // numeric value of the exception within a particular type
98         ExceptionType type;
99     };
100     void getExceptionCodeDescription(ExceptionCode, ExceptionCodeDescription&);
101 
102 } // namespace WebCore
103 
104 #endif // ExceptionCode_h
105