number Property (Error) (JavaScript)
JavaScript - Internet Explorer 10
Returns or sets the numeric value associated with a specific error. The Error object's default property is number.
object.number [= errorNumber]
The following example causes an exception to be thrown and displays the error code that is derived from the error number.
try { // Cause an error. var x = y; } catch(e) { document.write ("Error Code: "); document.write (e.number & 0xFFFF) document.write ("<br />"); document.write ("Facility Code: ") document.write(e.number>>16 & 0x1FFF) document.write ("<br />"); document.write ("Error Message: ") document.write (e.message) }
The output of this code is as follows.
Error Code: 5009
Facility Code: 10
Error Message: 'y' is undefined
Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards. Also supported in Windows Store apps. See Version Information.
Applies To: Error Object (JavaScript)
