louischatriot / nedb

The JavaScript Database, for Node.js, nw.js, electron and the browser
MIT License
13.46k stars 1.03k forks source link

How to catch abort if the capacity of storage is full?? #685

Open ozaryo opened 2 years ago

ozaryo commented 2 years ago

I want to catch the abort if storage is full and it can't insert or update data. but this library can't catch abort. When I try to insert data if capacity of storage is full, it doesn't insert data in indexDB.

please tell me how to catch abort.

I try this code but "err" is null.

async insert(argTableName: string, obj: any): Promise { await this.open(argTableName); return new Promise((resolve, reject) => { LocalDatabaseService.m_any_database[argTableName].insert(obj, (err, newDocs) => { if (!err) { if (newDocs.length === obj.length) { console.log("Sucess=" + newDocs.length); return resolve(newDocs.length); } } return reject(-1); }); }); }

it has already opened DB and create NeDb instance.

Browser :Chrome. image