W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2015

Re: [IndexedDB] When is an error event dispatched at a transcation?

From: Joshua Bell <jsbell@google.com>
Date: Thu, 5 Feb 2015 17:59:52 +0000
Message-ID: <CAD649j7RdGYNg0-HrrDH52s_Zt9dRkB+KFjf2c_C0+gw_jPzKA@mail.gmail.com>
To: Glen Huang <curvedmark@gmail.com>
Cc: Webapps WG <public-webapps@w3.org>
On Thu, Feb 5, 2015 at 12:58 PM, Glen Huang <curvedmark@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.
Received on Thursday, 5 February 2015 18:00:19 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:27:25 UTC