From d3c169932f10c38a258b27dd3b28bb6d2dfaf6fb 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..dfd310aa7 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 occurred 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 doesStoreExist', + { name, storeName, db }, + 'An unexpected error occured while trying to access the browser database.' + ); }); if (db) {