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

2015-02-05 Thread Glen Huang
Darn it, I forgot they bubble. Thank you for the detailed explanation.

> On Feb 6, 2015, at 1:59 AM, Joshua Bell  wrote:
> 
> On Thu, Feb 5, 2015 at 12:58 PM, Glen Huang  > 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.
> 



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

2015-02-05 Thread Joshua Bell
On Thu, Feb 5, 2015 at 12:58 PM, Glen Huang  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.