[Bug 26903] Parameter validation errors should return SyntaxError not DataError

https://www.w3.org/Bugs/Public/show_bug.cgi?id=26903

--- Comment #8 from Mark Watson <watsonm@netflix.com> ---
(In reply to Ryan Sleevi from comment #7)
> (In reply to Mark Watson from comment #4)
> > That may well be a good idea. I'd like to hear what others think. For the
> > moment I'll at least make the specification internally consistent.
> 
> I agree with Boris that SyntaxError surprises me.

It's not surprising it was used this way given then definition we have (see
comment #0), but I think the definition is wrong. Out-of-range is not a
'syntax' issue.

In fact I am not sure there can be any syntax problems with a method call other
than missing required parameters: everything passed in is already a valid JS
type and if it is not the right type this is a TypeError.

We could say "missing or invalid" in the SyntaxError definition just in case.

> DataError made some degree
> of sense, but it had its own set of complexity attached to it. TypeError
> strikes me as more internally consistent.
> 
> Or is InvalidAccessError more consistent?

We've used InvalidAccessError for cases where you try to use a key for
something it cannot do: it doesn't have the right usage or extractable value or
providing the wrong kind of public key to a DH derive.

Shall we switch to TypeError for the out-of-range cases ?

Note that this is dependent on the other discussion of whether we should switch
to OperationError to give flexibility to implementations to delegate range
checks to libraries that might not expose the reason for a failure.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Tuesday, 7 October 2014 14:23:08 UTC