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

Darn it, I forgot they bubble. Thank you for the detailed explanation.

> On Feb 6, 2015, at 1:59 AM, Joshua Bell <jsbell@google.com> wrote:
> 
> On Thu, Feb 5, 2015 at 12:58 PM, Glen Huang <curvedmark@gmail.com <mailto: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 Friday, 6 February 2015 01:07:25 UTC