From 20e43faa89f1e4618a6d39f3fc824df03b55c98a Mon Sep 17 00:00:00 2001 From: Lorenz Sieben Date: Wed, 18 Jan 2023 13:57:27 +0100 Subject: [PATCH] Add proper context to rethrow in PrivacyAsyncStorage In #1014, we found that proper error messages were missing from PrivacyAsyncStorage, which made it harder to debug. I added those now. --- src/Utility/PrivacyAsyncStorage.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Utility/PrivacyAsyncStorage.ts b/src/Utility/PrivacyAsyncStorage.ts index 8c23dde19..15f4ae3a9 100644 --- a/src/Utility/PrivacyAsyncStorage.ts +++ b/src/Utility/PrivacyAsyncStorage.ts @@ -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)) { @@ -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) {