number Property

number Property

Returns or sets the numeric value associated with a specific error.



Any instance of the Error object.

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.

The following example causes an exception to be thrown and displays the error code that is derived from the error number.

    var arr = new Array(-1);
    print ("Error Code: " + (e.number & 0xFFFF));
    print ("Facility Code: " + (e.number>>16 & 0x1FFF));
    print ("Error Message: " + e.message);
    print ("Error 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

Community Additions

© 2015 Microsoft