[indexeddb] Exception type for NON_TRANSIENT_ERR code

On Thursday, September 29, 2011 12:04 AM, Jonas Sicking wrote:
> For several of these I think we can reuse existing DOMExceptions.
> Here's how I'd map the exceptions which are currently in the IndexedDB
> spec:
> 
> UNKNOWN_ERR
> Mint a new UnknownError. Alternatively we could simply throw an
> ECMAScript Error object with no more specific type.
> 
> 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.  This will also allow us to assign a code value of 0 and a message: "This error occurred because an operation was not allowed on an object. A retry of the same operation would fail unless the cause of the error is corrected."

What do you think?

Israel

Received on Monday, 3 October 2011 23:21:54 UTC