number Property
Returns or sets the numeric value associated with a specific error.
object.number
Arguments
- object
Any instance of the Error object.
Remarks
An error number is a 32-bit value. The upper 16-bit word is the facility code, while the lower word is the actual error code. To determine the actual error code, use the & (bitwise And) operator to combine the number property with the hexadecimal number 0xFFFF.
Example
The following example causes an exception to be thrown, and displays the error code that is derived from the error number.
try
{
var arr = new Array(-1);
}
catch(e)
{
print ("Error Code: " + (e.number & 0xFFFF));
print ("Facility Code: " + (e.number>>16 & 0x1FFF));
print ("Error Message: " + e.message);
print ("Error Name: " + e.name);
}
The output of this code is as follows.
Error Code: 5029
Facility Code: 10
Error Message: Array length must be zero or a positive integer
Error Name: RangeError
Requirements
Applies To:
See Also
Reference
message Property (Visual Studio - JScript)
Change History
Date |
History |
Reason |
---|---|---|
July 2009 |
Modified example. |
Content bug fix. |
March 2009 |
Modified example. |
Information enhancement. |