Skip to content

Commit 829707b

Browse files
authored
Merge pull request #772 from callstack-internal/feat/87781-remove-diskio-from-storage-errors
[No QA] feat: update storrage errors array
2 parents 272cbcb + f04d4e9 commit 829707b

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

lib/OnyxUtils.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ const IDB_STORAGE_ERRORS = [
5757
// SQLite errors that indicate storage capacity issues where eviction can help
5858
const SQLITE_STORAGE_ERRORS = [
5959
'database or disk is full', // Device storage is full
60-
'disk I/O error', // File system I/O failure, often due to insufficient space or corrupted storage
61-
'out of memory', // Insufficient RAM or storage space to complete the operation
6260
] as const;
6361

6462
const STORAGE_ERRORS = [...IDB_STORAGE_ERRORS, ...SQLITE_STORAGE_ERRORS];

tests/unit/onyxUtilsTest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ describe('OnyxUtils', () => {
360360
const retryOperationSpy = jest.spyOn(OnyxUtils, 'retryOperation');
361361
const genericError = new Error('Generic storage error');
362362
const invalidDataError = new Error("Failed to execute 'put' on 'IDBObjectStore': invalid data");
363-
const memoryError = new Error('out of memory');
363+
const diskFullError = new Error('database or disk is full');
364364

365365
it('should retry only one time if the operation is firstly failed and then passed', async () => {
366366
StorageMock.setItem = jest.fn(StorageMock.setItem).mockRejectedValueOnce(genericError).mockImplementation(StorageMock.setItem);
@@ -387,7 +387,7 @@ describe('OnyxUtils', () => {
387387
});
388388

389389
it('should not retry in case of storage capacity error and no keys to evict', async () => {
390-
StorageMock.setItem = jest.fn().mockRejectedValue(memoryError);
390+
StorageMock.setItem = jest.fn().mockRejectedValue(diskFullError);
391391

392392
await Onyx.set(ONYXKEYS.TEST_KEY, {test: 'data'});
393393

0 commit comments

Comments
 (0)