Closed anba closed 4 years ago
That sounds very reasonable to me.
@littledan - can you confirm?
If so, I'll update all uses of RangeError
to TypeError
.
@anba 's rationale for TypeError rather than RangeError in this case sounds correct to me.
I'm going to replace RangeError
with TypeError
in the three positions where we added it recently.
43 used
RangeError
when other date-time options are used withtimeStyle
/dateStyle
, butTypeError
is probably the more accurate error type here.ECMA-402 currently uses
RangeError
whenever a value isn't a member of the set of allowed values:GetOption
operation).NaN
or infinite).Whereas
TypeError
is used when a value:CanonicalizeLocaleList
operation).SetNumberFormatUnitOptions
).Interpreting that the set of allowed values for the date/time options is reduced to the empty set when
timeStyle
/dateStyle
are present and thereforeRangeError
is the correct error type is maybe a bit dubious. I'd rather see it more similar to the missingunit
orcurrency
case inSetNumberFormatUnitOptions
, where a user provided a logically incorrect options object.