DOMCoreException.cpp [plain text]
#include "config.h"
#include "DOMCoreException.h"
namespace WebCore {
static struct CoreException {
const char* const name;
const char* const description;
} coreExceptions[] = {
{ "IndexSizeError", "Index or size was negative, or greater than the allowed value." },
{ 0, 0 }, { "HierarchyRequestError", "A Node was inserted somewhere it doesn't belong." },
{ "WrongDocumentError", "A Node was used in a different document than the one that created it (that doesn't support it)." },
{ "InvalidCharacterError", "An invalid or illegal character was specified, such as in an XML name." },
{ 0, 0 }, { "NoModificationAllowedError", "An attempt was made to modify an object where modifications are not allowed." },
{ "NotFoundError", "An attempt was made to reference a Node in a context where it does not exist." },
{ "NotSupportedError", "The implementation did not support the requested type of object or operation." },
{ "InUseAttributeError", "An attempt was made to add an attribute that is already in use elsewhere." },
{ "InvalidStateError", "An attempt was made to use an object that is not, or is no longer, usable." },
{ "SyntaxError", "An invalid or illegal string was specified." },
{ "InvalidModificationError", "An attempt was made to modify the type of the underlying object." },
{ "NamespaceError", "An attempt was made to create or change an object in a way which is incorrect with regard to namespaces." },
{ "InvalidAccessError", "A parameter or an operation was not supported by the underlying object." },
{ 0, 0 }, { "TypeMismatchError", "The type of an object was incompatible with the expected type of the parameter associated to the object." },
{ "SecurityError", "An attempt was made to break through the security policy of the user agent." },
{ "NetworkError", "A network error occurred." },
{ "AbortError", "The user aborted a request." },
{ "URLMismatchError", "A worker global scope represented an absolute URL that is not equal to the resulting absolute URL." },
{ "QuotaExceededError", "An attempt was made to add something to storage that exceeded the quota." },
{ "TimeoutError", "A timeout occurred." },
{ "InvalidNodeTypeError", "The supplied node is invalid or has an invalid ancestor for this operation." },
{ "DataCloneError", "An object could not be cloned." }
};
bool DOMCoreException::initializeDescription(ExceptionCode ec, ExceptionCodeDescription* description)
{
description->typeName = "DOM";
description->code = ec;
description->type = DOMCoreExceptionType;
size_t tableSize = WTF_ARRAY_LENGTH(coreExceptions);
size_t tableIndex = ec - INDEX_SIZE_ERR;
description->name = tableIndex < tableSize ? coreExceptions[tableIndex].name : 0;
description->description = tableIndex < tableSize ? coreExceptions[tableIndex].description : 0;
return true;
}
}