Skip to content

Commit 6ecbf56

Browse files
committed
Catch more heartbeat read/write errors
1 parent 9c31727 commit 6ecbf56

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/app/src/indexeddb.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@ export async function readHeartbeatsFromIndexedDB(
6262
): Promise<HeartbeatsInIndexedDB | undefined> {
6363
try {
6464
const db = await getDbPromise();
65-
return db
65+
const result = await db
6666
.transaction(STORE_NAME)
6767
.objectStore(STORE_NAME)
68-
.get(computeKey(app)) as Promise<HeartbeatsInIndexedDB | undefined>;
68+
.get(computeKey(app));
69+
return result;
6970
} catch (e) {
7071
if (e instanceof FirebaseError) {
7172
logger.warn(e.message);
@@ -87,7 +88,7 @@ export async function writeHeartbeatsToIndexedDB(
8788
const tx = db.transaction(STORE_NAME, 'readwrite');
8889
const objectStore = tx.objectStore(STORE_NAME);
8990
await objectStore.put(heartbeatObject, computeKey(app));
90-
return tx.done;
91+
await tx.done;
9192
} catch (e) {
9293
if (e instanceof FirebaseError) {
9394
logger.warn(e.message);

0 commit comments

Comments
 (0)