-
-
Notifications
You must be signed in to change notification settings - Fork 641
DexieError
David Fahlander edited this page Mar 15, 2016
·
28 revisions
since v.1.3.3
class DexieError extends Error {}
Acts as the base class for exceptions that can be returned in rejected Dexie promises.
-
Error
- SyntaxError
- TypeError
- Dexie.DexieError
- Dexie.ModifyError
- Dexie.OpenFailedError
- Dexie.VersionChangeError
- Dexie.SchemaError
- Dexie.UpgradeError
- Dexie.InvalidTableError
- Dexie.MissingAPIError
- Dexie.NoSuchDatabaseError
- Dexie.InvalidArgumentError
- Dexie.SubTransactionError
- Dexie.UnsupportedError
- Dexie.InternalError
- Dexie.DatabaseClosedError
- Dexie.UnknownError
- Dexie.ConstraintError
- Dexie.DataError
- Dexie.TransactionInactiveError
- Dexie.ReadOnlyError
- Dexie.VersionError
- Dexie.NotFoundError
- Dexie.InvalidStateError
- Dexie.InvalidAccessError
- Dexie.AbortError
- Dexie.TimeoutError
- Dexie.QuotaExceededError
- Dexie.DataCloneError
doSomeDatabaseWork().then(function(){
// Success
}).catch(Dexie.ModifyError, function (e) {
// Failed with ModifyError. Check out e.failures
console.error ("ModifyError occurred: " + e.failures.length +
" failures and " + e.successCount + " successful operations");
}).catch(Dexie.DexieError, funtion (e) {
// Any other Dexie related error occurred
console.error ("Error: " + e.message);
}).catch(funtion (e) {
// Other error such as a string was thrown
console.error (e);
});
async function() {
try {
await doSomeDatabaseWork();
} catch (e) {
if (e instanceof Dexie.ModifyError) {
// Failed with ModifyError. Check out e.failures
console.error ("ModifyError occurred: " + e.failures.length +
" failures and " + e.successCount + " successful operations");
} else if (e instanceof Dexie.DexieError) {
// Any other Dexie related error occurred
console.error ("Error: " + e.message);
} else {
// Other error such as a string was thrown
console.error (e);
}
}
}
doSomeDatabaseWork().then(function(){
// Success
}).catch(function (error) {
switch (error.name) {
case "UpgradeError": // or case Dexie.errnames.Upgrade: ...
console.error ("Upgrade error");
break;
case "ModifyError": // or case Dexie.errnames.Modify: ...
console.error ("Modify error");
break;
default:
console.error ("error: " + e);
}
});
name: string | Name of the error |
message: string | Detailed message |
inner?: any | Inner exception instance (if any) |
stack?: string | Can be present if the error was thown. If signaled, there wont be any call stack. |
Dexie.js - minimalistic and bullet proof indexedDB library