# Dexie.BulkError

#### Inheritance Hierarchy

* [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)
  * Dexie.DexieError
    * Dexie.BulkError

#### Description

Error that may occur in Table.bulkAdd(), Table.bulkPut() or Table.bulkDelete().

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.

#### Properties

| failures                              | Array of Error objects of all errors that have occurred        |
| ------------------------------------- | -------------------------------------------------------------- |
| failuresByPos *(since 3.1.0-alpha.7)* | Object that maps each failing operation's position to an error |

#### Properties derived from Error

[**message**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/message)

[**name**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name)

#### Sample

```javascript
db.friends.bulkAdd([
    {id: "shouldBeUnique", name: "Foo", age: 99},
    {id: "shouldBeUnique", name: "Bar", age: 21}])
.catch('BulkError', err => {
    err.failures.forEach(failure => {
        console.error (failure.message);
    });
    // If on dexie@>3.1.0-alpha.6:
    for (const [pos, error] of Object.entries(err.failuresByPos)) {
      console.error(`Operation ${pos} failed with ${error}`);
    }
});
```

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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dexiejs.typogram.co/dexieerror/dexie.bulkerror.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
