This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27248 - Consider changing the exceptions
Summary: Consider changing the exceptions
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: Encoding (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: Unsorted
Assignee: Anne
QA Contact: sideshowbarker+encodingspec
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-05 12:21 UTC by Domenic Denicola
Modified: 2014-11-17 14:42 UTC (History)
2 users (show)

See Also:


Attachments

Description Domenic Denicola 2014-11-05 12:21:09 UTC
https://encoding.spec.whatwg.org/#interface-textencoder

[[
throws a TypeError. 
]]

In general RangeErrors are better used when only an enumeration should be allowed and you want to throw when outside that range. See e.g. http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.normalize
Comment 1 Anne 2014-11-05 12:46:06 UTC
String.prototype.normalize was defined after IDL enumerations which use TypeError...
Comment 2 Domenic Denicola 2014-11-05 12:54:13 UTC
Hmm yeah this conversation is starting to feel familiar...

I will try to PR WebIDL to use RangeError and see where that discussion goes.