Creating your own errors
brendan at mozilla.com
Tue Aug 6 12:40:10 PDT 2013
Allen Wirfs-Brock wrote:
> We did discuss this, as record in
> https://bugs.ecmascript.org/show_bug.cgi?id=224 , and concluded that
> we it we didn't want to add any new built-in exceptions. Of the
> existing exceptions , RangeError is closest in concept to what might
> be described as ValueError.
I'd be ok with adding DomainError -- dual, as Mark says -- cheap
one-time addition, not repeated, sold out performance, retired and tax
fugitive after ;-).
> On Aug 6, 2013, at 11:51 AM, Brendan Eich wrote:
>> Problem is, "TypeError" for what Python calls "ValueError", what JS
>> might call "DomainError" to go with "RangeError", is lame. Allen,
>> Rick, I forget: have we discussed DomainError or ValueError?
>> Anne van Kesteren wrote:
>>> On Wed, Jul 17, 2013 at 7:10 PM, Jonas Sicking<jonas at sicking.cc
>>> <mailto:jonas at sicking.cc>> wrote:
>>>> Good point. It's entirely plausible that we could simply use the ES
>>>> SyntaxError in all cases where DOMException SyntaxError is being
>>>> thrown today. Would need to be tested though.
>>> shouldn't use it for where we throw "SyntaxError" in platform APIs
>>> today per discussion with Allen. (He considered the usage for JSON
>>> already as a mistake.)
More information about the es-discuss