IDBDatabaseException.cpp [plain text]
#include "config.h"
#if ENABLE(INDEXED_DATABASE)
#include "IDBDatabaseException.h"
namespace WebCore {
static struct IDBDatabaseExceptionNameDescription {
const char* const name;
const char* const description;
} idbDatabaseExceptions[] = {
{ "UNKNOWN_ERR", "An unknown error occurred within Indexed Database." },
{ "NON_TRANSIENT_ERR", "NON_TRANSIENT_ERR" }, { "NOT_FOUND_ERR", "The name supplied does not match any existing item." },
{ "CONSTRAINT_ERR", "The request cannot be completed due to a failed constraint." },
{ "DATA_ERR", "The data provided does not meet the requirements of the function." },
{ "NOT_ALLOWED_ERR", "This function is not allowed to be called in such a context." },
{ "TRANSACTION_INACTIVE_ERR", "A request was placed against a transaction which is either currently not active, or which is finished." },
{ "ABORT_ERR", "The transaction was aborted, so the request cannot be fulfilled." },
{ "READ_ONLY_ERR", "A write operation was attempted in a read-only transaction." },
{ "TIMEOUT_ERR", "A lock for the transaction could not be obtained in a reasonable time." }, { "QUOTA_ERR", "The operation failed because there was not enough remaining storage space, or the storage quota was reached and the user declined to give more space to the database." }, { "VER_ERR", "An attempt was made to open a database using a lower version than the existing version." } };
bool IDBDatabaseException::initializeDescription(ExceptionCode ec, ExceptionCodeDescription* description)
{
if (ec < IDBDatabaseExceptionOffset || ec > IDBDatabaseExceptionMax)
return false;
description->typeName = "DOM IDBDatabase";
description->code = ec - IDBDatabaseExceptionOffset;
description->type = IDBDatabaseExceptionType;
size_t tableSize = WTF_ARRAY_LENGTH(idbDatabaseExceptions);
size_t tableIndex = ec - UNKNOWN_ERR;
description->name = tableIndex < tableSize ? idbDatabaseExceptions[tableIndex].name : 0;
description->description = tableIndex < tableSize ? idbDatabaseExceptions[tableIndex].description : 0;
return true;
}
}
#endif // ENABLE(INDEXED_DATABASE)