Skip to content

Dexie.BulkError

David Fahlander edited this page Nov 25, 2016 · 4 revisions

Inheritance Hierarchy

Description

Error that may occur in Table.bulkAdd().

The method that may throw this error can perform multiple operations on a table. Therefore this error object will contain an array of the errors the occurred during the failed operations.

Properies

failures Array of Error objects of all errors that have occurred

Properties derived from Error

Sample

db.friends.bulkAdd([
    {id: "shouldBeUnique", name: "Foo", age: 99},
    {id: "shouldBeUnique", name: "Bar", age 21}])
.catch(Dexie.BulkError, function (err) {
    err.failures.forEach(function (failure) {
        console.error (failure.message);
    });
});

Note: Catching the error means that the successful operations will be saved. If not catching the error, all operations will be reverted and if there is an ongoing transaction, it will be aborted.

Clone this wiki locally