Re: [indexeddb] Exception type for NON_TRANSIENT_ERR code

On Mon, Oct 3, 2011 at 5:10 PM, Joshua Bell <jsbell@chromium.org> wrote:
> On Mon, Oct 3, 2011 at 4:21 PM, Israel Hilerio <israelh@microsoft.com>
> wrote:
>>
>> On Thursday, September 29, 2011 12:04 AM, Jonas Sicking wrote:
>> > NON_TRANSIENT_ERR
>> > I think in many cases we should simply throw a TypeError here. That
>> > seems
>> > to match closely to how TypeError is used by WebIDL now.
>>
>> As I'm mapping the Exception codes to the new Exception type model, I
>> thought we should mint a new type for NON_TRANSIENT_ERR, NonTransientError.
>>  The reason is that TypeError seems to be designed to cover all intrinsic
>> conversion cases and NON_TRANSIENT_ERR seems to be dealing with additional
>> validation beyond what TypeError normally checks for.
>
> As an aside, the current draft has IDBFactory.cmp() raise a
> NON_TRANSIENT_ERR when an invalid key is used, but most of the other
> functions that take keys  (IDBObjectStore.add/put/get/delete(), etc) raise a
> DATA_ERR on invalid keys. It would be nice to be consistent in the case
> where the explicitly specified key is invalid (vs. when it is a calculated
> key).

Agreed. DataError seems like a better exception here.

/ Jonas

Received on Tuesday, 4 October 2011 00:56:57 UTC