Error objects: RangeError, TypeError, ValueError
Brendan Eich
brendan at mozilla.com
Tue Nov 22 11:57:51 PST 2011
On Nov 22, 2011, at 10:49 AM, Allen Wirfs-Brock wrote:
> On Nov 22, 2011, at 10:14 AM, Brendan Eich wrote:
>
>> On Nov 22, 2011, at 9:37 AM, Allen Wirfs-Brock wrote:
>> ...
>>
>>> Unfortunately, as it now stands you have to use the implementation dependent message property value to actually identify specific exceptions.
>>
>> *Error.prototype.name is normatively specified for all the built-in Error constructors.
>
> Yes, but name doesn't discriminate the actual cause of the exception. There is no normative way to distinguish a RangeError generated by 1.0.toPrecision(40) from a RangeError generated by (new Array(1.2))
I see -- but do we really want name variations for all of those? Where does the offending value go, if anywhere?
>>> I wonder if for new exception occurrences (in our specs.) we should specify unique implementation independent name property values. To do so, we would have to develop a meaningful fine-grained naming scheme.
>>
>> This would fit in just Error, as JJB just suggested.
>
> The difference is that instanceof can be used to detect RageError, TypeError, etc. instances
Right, instanceof. Kind of a flop, especially in a mutliple-globals embedding.
/be
More information about the es-discuss
mailing list