RE: Exception usage

On Wed, Feb 12, 2014 at 2:46 AM, Anne van Kesteren <> wrote:
> On Wed, Feb 12, 2014 at 1:20 AM, Olli Pettay <> wrote:
> >

> > is still quite different.
> > There you have a predefined set of values, and if something else is passed,
> > it is RangeError.
> >
> > pointerId can be any random number. RangeError gives a wrong hint that there
> > would be some sort of
> > continuous range, and that is explicitly what we don't want.
> Fair enough. Then TypeError would be fine.

I think TypeError is also inappropriate. The exceptional scenario includes cases where the argument type is correct (number) but the particular value is not.

In general, using ES error types when appropriate makes a lot of sense. But in this case, I don't see an existing ES error that fits. All of the close options would likely cause developer confusion (e.g. pointer Ids have some bounded range or that the methods take something other than a number) as described by Olli and Matt.

> (Can code always know the active pointers btw?)

With a fairly simply state machine, yes. Pointers become active when pointerdown fires and become inactive when pointerup or pointercancel fire.  In the future, we might explore exposing a list of active pointers (but it's not a priority for our group at the moment).

Received on Wednesday, 12 February 2014 23:58:24 UTC