Skip to content

Dexie.on.error

dfahlander edited this page Dec 1, 2014 · 16 revisions

Syntax

db.on("error", function (error) {});

Parameters

error: Any Any uncatched error from a request or transaction will bubble up to the subscriber.

Remarks

This event will fire whenever you perform a database operation that fails, or if you are within a transaction scope and an exception is thrown.

db.on('error') will only fire in the following scenarios:

  • You are in a transaction scope and an exception occur and you dont catch the Promise returned from the db.transaction() method.
  • You are doing a database operation that fails with an exception and you don't catch the resulting promise.

But not if:

  • You are outside of a transaction and the error doesnt occur from within a database operation.

Sample

db.on("error", function(e) { console.error (e.stack || e); });

db.friends.put(window.open); // Functions cannot be put into database.
Clone this wiki locally