File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -891,13 +891,13 @@ function retryOperation<TMethod extends RetriableOnyxOperation>(
891891 Logger . logInfo ( `Out of storage. Evicting least recently accessed key (${ keyForRemoval } ) and retrying. Error: ${ error } ` ) ;
892892 reportStorageQuota ( error ) ;
893893
894- // @ts -expect-error No overload matches this call.
895894 return remove ( keyForRemoval ) . then ( ( ) => {
896895 // Mark the eviction only once the deletion has actually completed, immediately before the
897896 // retry it pairs with. Recording earlier lets a concurrent write's capacity failure consume
898897 // the marker as a no-progress cycle while this deletion is still pending and may yet free
899898 // space — so the verdict belongs to the retry that follows the deletion, not the eviction call.
900899 StorageCircuitBreaker . recordEviction ( ) ;
900+ // @ts -expect-error No overload matches this call.
901901 return onyxMethod ( defaultParams , nextRetryAttempt ) ;
902902 } ) ;
903903}
Original file line number Diff line number Diff line change 1- import type { ValueOf } from 'type-fest' ;
2-
31/**
42 * Shared vocabulary for storage write failures. The *classes* are engine-agnostic; the *matching*
53 * is not — each storage provider knows its own error dialect and owns its classifier (see each
@@ -26,8 +24,6 @@ const StorageErrorClass = {
2624 UNKNOWN : 'unknown' ,
2725} as const ;
2826
29- type StorageErrorClassValue = ValueOf < typeof StorageErrorClass > ;
30-
3127/**
3228 * Normalizes any thrown value into a lowercased `{name, message}` pair for matching. Shared by every
3329 * provider's classifier so they all extract the error the same way.
@@ -40,4 +36,3 @@ function getErrorParts(error: unknown): {name: string; message: string} {
4036}
4137
4238export { StorageErrorClass , getErrorParts } ;
43- export type { StorageErrorClassValue } ;
Original file line number Diff line number Diff line change 1+ import type { ValueOf } from 'type-fest' ;
12import { StorageErrorClass , getErrorParts } from '../../errors' ;
2- import type { StorageErrorClassValue } from '../../errors' ;
33
44/**
55 * Classifies an IndexedDB write failure into the shared storage taxonomy (lib/storage/errors.ts).
66 * Matching is done on the lowercased error name and message. This is the IndexedDB engine's own
77 * dialect — it is NOT shared with other engines.
88 */
9- function classifyIDBError ( error : unknown ) : StorageErrorClassValue {
9+ function classifyIDBError ( error : unknown ) : ValueOf < typeof StorageErrorClass > {
1010 const { name, message} = getErrorParts ( error ) ;
1111
1212 // Non-serializable data passed to IDBObjectStore.put — retrying is futile.
Original file line number Diff line number Diff line change 1+ import type { ValueOf } from 'type-fest' ;
12import { StorageErrorClass , getErrorParts } from '../errors' ;
2- import type { StorageErrorClassValue } from '../errors' ;
33
44/**
55 * Classifies a SQLite write failure into the shared storage taxonomy (lib/storage/errors.ts).
@@ -10,7 +10,7 @@ import type {StorageErrorClassValue} from '../errors';
1010 * SQLite surfaces fewer distinct write-failure shapes than IndexedDB. As telemetry from the UNKNOWN
1111 * bucket (see OnyxUtils.retryOperation) reveals recurring native errors, add matchers here.
1212 */
13- function classifySQLiteError ( error : unknown ) : StorageErrorClassValue {
13+ function classifySQLiteError ( error : unknown ) : ValueOf < typeof StorageErrorClass > {
1414 const { message} = getErrorParts ( error ) ;
1515
1616 // Device disk full.
Original file line number Diff line number Diff line change 1+ import type { ValueOf } from 'type-fest' ;
12import type { OnyxKey , OnyxValue } from '../../types' ;
23import type { FastMergeReplaceNullPatch } from '../../utils' ;
3- import type { StorageErrorClassValue } from '../errors' ;
4+ import type { StorageErrorClass } from '../errors' ;
45
56type StorageKeyValuePair = [ key : OnyxKey , value : OnyxValue < OnyxKey > , replaceNullPatches ?: FastMergeReplaceNullPatch [ ] ] ;
67type StorageKeyList = OnyxKey [ ] ;
@@ -89,11 +90,11 @@ type StorageProvider<TStore> = {
8990 getDatabaseSize : ( ) => Promise < DatabaseSize > ;
9091
9192 /**
92- * Classifies a write error from THIS engine into the shared {@link StorageErrorClassValue } taxonomy.
93+ * Classifies a write error from THIS engine into the shared {@link StorageErrorClass } taxonomy.
9394 * Each provider owns its own matchers (IndexedDB DOMExceptions, SQLite messages, …) so the central
9495 * taxonomy stays engine-agnostic. Anything the provider doesn't recognize must return UNKNOWN.
9596 */
96- classifyError : ( error : unknown ) => StorageErrorClassValue ;
97+ classifyError : ( error : unknown ) => ValueOf < typeof StorageErrorClass > ;
9798
9899 /**
99100 * @param onStorageKeyChanged Storage synchronization mechanism keeping all opened tabs in sync
You can’t perform that action at this time.
0 commit comments