On Jul 10, 2013, at 12:55 PM, Domenic Denicola wrote:
> From: Jonas Sicking [[email protected]]
>
>>
>
>> DOMError even has a constructor which allows setting .name to anything: new
>> DOMError(name, message);
>
> This seems quite bad: error constructors always (in ES)/almost always (in
> user space) take `message` as their first parameter, with other parameters
> beyond that being introduced by various user-space errors.
IE has a legacy feature that is similar but different
see http://msdn.microsoft.com/en-us/library/ff521053(v=vs.85).aspx
which also necessitated a change in the Error constructor
(from
http://download.microsoft.com/download/8/4/2/8427CF1B-08B3-4557-952D-102E7A8FA64C/%5BMS-ES3%5D.pdf
)
2.1.142 [ECMA-262] Section 15.11.2.1, new Error (messageOrNumber)
V0214:
When the Error constructor is called with one argument the following steps are
taken:
1. The [[Prototype]] property of the newly constructed object is set to
the original Error prototype object, the one that is the initial value of
Error.prototype ([ECMA-262] section 15.11.3.1).
2. The [[Class]] property of the newly constructed Error object is set to
"Error".
3. Let message be the empty string.
4. Let number be NaN.
5. If messageOrNumber is undefined, then go to step 8.
6. Let number be ToNumber(messageOrNumber).
7. If number is not NaN, then go to step 9.
8. Let message be ToString(messageOrNumber).
9. The description property of the newly constructed object is set to
message.
10. If the argument message is not undefined, the The message property of
the newly constructed object is set to ToString(message).
11. The name property of the newly constructed object is set to "Error".
12. If number is NaN, then go to step 14.
13. The number property of the newly constructed object is set to number.
14. Return the newly constructed object.
I really don't think you want to go down that path...
Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss