Skip to content

Commit a59d8e6

Browse files
leshniakclaude
andcommitted
refactor: simplify error type checks per review feedback
- isBackingStoreError: use Error instead of DOMException, drop .name check - InvalidStateError catch: same simplification - Remove issue link from JSDoc Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6cf1bf3 commit a59d8e6

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

lib/storage/providers/IDBKeyValProvider/createStore.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ const HEAL_ATTEMPTS_MAX = 3;
88
* Detects the Chromium-specific IDB backing store corruption error.
99
* Fires when LevelDB files backing IndexedDB are corrupted and Chrome's
1010
* internal recovery (RepairDB -> delete -> recreate) also fails.
11-
* https://github.com/Expensify/App/issues/87862
1211
*/
1312
function isBackingStoreError(error: unknown): boolean {
14-
return error instanceof DOMException && error.name === 'UnknownError' && error.message.includes('Internal error opening backing store');
13+
return error instanceof Error && error.message.includes('Internal error opening backing store');
1514
}
1615

1716
// This is a copy of the createStore function from idb-keyval, we need a custom implementation
@@ -119,7 +118,7 @@ function createStore(dbName: string, storeName: string): UseStore {
119118
executeTransaction(txMode, callback)
120119
.then(resetHealBudget)
121120
.catch((error) => {
122-
if (error instanceof DOMException && error.name === 'InvalidStateError') {
121+
if (error instanceof Error && error.name === 'InvalidStateError') {
123122
Logger.logAlert('IDB InvalidStateError, retrying with fresh connection', {
124123
dbName,
125124
storeName,

0 commit comments

Comments
 (0)