Skip to content

Commit

Permalink
Add proper context to rethrow in PrivacyAsyncStorage
Browse files Browse the repository at this point in the history
In #1014, we found that proper error messages were missing from PrivacyAsyncStorage, which made it harder to debug. I added those now.
  • Loading branch information
zner0L committed Jan 18, 2023
1 parent 642c381 commit 20e43fa
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Utility/PrivacyAsyncStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@ export class PrivacyAsyncStorage {
: (this.#options.version || 1) + 1;
return;
}
rethrow(e);
rethrow(
e,
'Unexpected error while opening IndexedDB in PrivacyAsyncStorage.getDb',
{
options: this.#options,
},
'An unexpected error uccurred while trying to open the database.'
);
})
.then((db) => {
if (db && !db.objectStoreNames.contains(this.#options.storeName)) {
Expand Down Expand Up @@ -141,7 +148,12 @@ export class PrivacyAsyncStorage {
db?.close();
return;
}
rethrow(e);
rethrow(
e,
'Error in doesStoreExists',
{ name, storeName, db },
'An unexpected error occured while trying to access the brwoser database.'
);
});

if (db) {
Expand Down

0 comments on commit 20e43fa

Please sign in to comment.