forked from mystiq/hydrogen-web
Expose error when we fail to createObjectStore
This commit is contained in:
parent
c824012968
commit
b54e884b7e
1 changed files with 6 additions and 1 deletions
|
@ -80,10 +80,15 @@ export function openDatabase(name: string, createObjectStore: CreateObjectStore,
|
||||||
try {
|
try {
|
||||||
await createObjectStore(db, txn, oldVersion, version);
|
await createObjectStore(db, txn, oldVersion, version);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.error(`Failed to createObjectStore in database=${name}`, err);
|
||||||
// try aborting on error, if that hasn't been done already
|
// try aborting on error, if that hasn't been done already
|
||||||
try {
|
try {
|
||||||
txn.abort();
|
txn.abort();
|
||||||
} catch (err) {}
|
} catch (err) {
|
||||||
|
// No-op: `InvalidStateError` is only thrown if the transaction has
|
||||||
|
// already been committed or aborted. Since we wanted the txn to
|
||||||
|
// be aborted anyway, it doesn't matter if this fails.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return reqAsPromise(req);
|
return reqAsPromise(req);
|
||||||
|
|
Loading…
Reference in a new issue