On Thu, Feb 5, 2015 at 12:58 PM, Glen Huang <curvedm...@gmail.com> wrote:
> The IDBTransaction interface exposes an onerror event handler. I wonder > when that handler gets called? The algorithm of "Steps for aborting a > transaction” dispatches error events at requests of the transaction, but > never at the transaction itself, only an abort event is dispatched, if I > understand the spec correctly. > > If that is true, why exposing the onerror event handler on the > IDBTransaction interface? > In the steps 3.3.12 Fire an error event, "The event bubbles and is cancelable. The propagation path for the event is the transaction's connection, then transaction and finally request." Which is to say: if cancelBubble() is not called, the event will bubble from the request to the transaction to the connection. A common use case is to attach an error handler on the transaction or database connection to e.g. log errors back to the server, rather than having to attach such a handler to every request.