UNPKG

react-native-onyx

Version:

State management for React Native

22 lines (21 loc) 963 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const errors_1 = require("../errors"); /** * Classifies a SQLite write failure into the shared storage taxonomy (lib/storage/errors.ts). * This is the SQLite engine's own dialect — it is NOT shared with other engines. It lives in a * standalone module (no `react-native-nitro-sqlite` import) so it can be reused without pulling in * native dependencies. * * SQLite surfaces fewer distinct write-failure shapes than IndexedDB. As telemetry from the UNKNOWN * bucket (see OnyxUtils.retryOperation) reveals recurring native errors, add matchers here. */ function classifySQLiteError(error) { const { message } = (0, errors_1.getErrorParts)(error); // Device disk full. if (message.includes('database or disk is full')) { return errors_1.StorageErrorClass.CAPACITY; } return errors_1.StorageErrorClass.UNKNOWN; } exports.default = classifySQLiteError;