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

RE: [indexeddb] Missing TransactionInactiveError Exception type for count and index methods

From: Israel Hilerio <israelh@microsoft.com>
Date: Tue, 24 Jan 2012 20:33:15 +0000
To: Jonas Sicking <jonas@sicking.cc>
CC: "jsbell@chromium.org" <jsbell@chromium.org>, "public-webapps@w3.org" <public-webapps@w3.org>, Adam Herchenroether <aherchen@microsoft.com>, Victor Ngo <vicngo@microsoft.com>
Message-ID: <F695AF7AA77CC745A271AD0F61BBC61E42807E1E@TK5EX14MBXC113.redmond.corp.microsoft.com>
On Tuesday, January 24, 2012 12:12 PM, Jonas Sicking wrote:
> On Tue, Jan 24, 2012 at 10:08 AM, Israel Hilerio <israelh@microsoft.com>
> wrote:
> >> >> In addition, the index method in IDBObjectStore uses
> >> >> InvalidStateError to convey two different meanings: the object has
> >> >> been removed or deleted and the transaction being used finished.
> >> >> It seems that it would be better to separate these into:
> >> >> * InvalidStateError when the source object has been removed or
> deleted.
> >> >> * TransactionInactiveError when the transaction being used is inactive.
> >> >>
> >> >> What do you think?  I can open a bug if we agree this is the
> >> >> desired behavior.
> >> >
> >> >
> >> > Did this come out of the discussion here:
> >> >
> >> > http://lists.w3.org/Archives/Public/public-webapps/2011OctDec/1589.
> >> > htm
> >> > l
> >> >
> >> > If so, the rationale for which exception type to use is included,
> >> > although no-one on the thread was deeply averse to the alternative.
> >> > If it's a different issue can give a more specific example?
> >>
> >> Right. I think InvalidStateErr is better, for the reason detailed in
> >> the above referenced email.
> >>
> >> I agree we're using the same exception for two error conditions, but
> >> I'm not terribly worried that this will make debugging harder for authors.
> >>
> >> But I don't feel strongly so if there's a good reason I'm ok with
> >> changing things.
> >>
> >> / Jonas
> >>
> >
> > I agree that InvalidStateErr makes sense here.  The issue we're presenting is
> the use of one exception for two error conditions.
> > We just want to remove the ambiguity and cleanup of the language.  We
> have this issue in the IDBObjectStore.index and IDBTransaction.objectStore
> methods.
> >
> > One alternative could be to just leave "InvalidStateError" and remove the
> "or" clause from the description.
> > That would leave us with:
> >
> > 1. InvalidStateError - Occurs if a request is made on a source object that
> has been deleted or removed.
> >
> > Alternatively, we could add one more exception to capture the "or" clause:
> >
> > 2. TransactionInactiveError - Occurs if the transaction the object store
> belongs to has finished.
> >
> > I'm okay with only doing #1, if you all agree.  This simplifies things and
> captures the idea stated in the reference email.  Let me know what you think.
> 
> Hmm.. I think I'm not fully following you. Did you intend for #1 to change
> normative behavior, or to be an editorial clarification?
> 
> Simply removing the part after the "or" seems to result in a normative
> change since nowhere would we say that an exception should be thrown if
> index() is called after a transaction has finished. I.e. removing it would mean
> that index() would have to return an IDBIndex instance even when called
> after the transaction has finished.
> 
> Maybe the solution is to change the text to something like: "Thrown if the
> function is called on a source object that has been deleted. Also thrown if the
> transaction the object store belongs to has finished."
> 
> / Jonas

Sorry for the confusion.  My assumption for #1 was that it would be okay not to throw an exception 
if a developer were to make a call to IDBObjectStore.index and IDBTransaction.objectStore when
there is no transaction as long as any requests from those objects would throw TransactionInactiveError.
This would leave TransactionInactiveError to be thrown by methods that return IDBRequests only.

In Alternative #2, we were proposing to add TransactionInactiveError to the exception list to avoid the
exception overloading.  It just seems weird to overload InvalidStateError with multiple definitions.

Should we just do #2, then?

Israel
Received on Tuesday, 24 January 2012 20:33:49 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:50 GMT