Skip to content

Commit a1b4187

Browse files
authored
[NOCSL] Catch Erorr in Domless environments (#52)
* add catch * adjust * add cases
1 parent b30acea commit a1b4187

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/constructorio-id.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@
1313
return true;
1414
} catch (e) {
1515
return (
16-
e instanceof DOMException &&
17-
e.name === 'QuotaExceededError' &&
18-
// acknowledge QuotaExceededError only if there's something already stored
19-
storage &&
20-
storage.length !== 0
16+
DOMException
17+
&& e instanceof DOMException
18+
&& (e.name === 'QuotaExceededError'
19+
|| e.name === 'QUOTA_EXCEEDED_ERR'
20+
|| e.name === 'NS_ERROR_DOM_QUOTA_REACHED'
21+
|| e.toString().indexOf('QUOTA_EXCEEDED_ERR') !== -1
22+
|| e.toString().indexOf('QuotaExceededError') !== -1)
23+
&& storage
24+
&& storage.length !== 0
2125
);
2226
}
2327
}

0 commit comments

Comments
 (0)