A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/javascript/Error/number below:

number · WebPlatform Docs

number Summary

Returns or sets the numeric value associated with a specific error. The Error object’s default property is number.

Syntax
object .number [ =  errorNumber ]
Object
Any instance of the Error object.
errorNumber
An integer representing an error.
Examples

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

try
     {
     
     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
Remarks

An error number is a 32-bit value. The upper 16-bit word is the facility code, and the lower word is the error code. To determine the error code, use the & (bitwise And) operator to combine the number property with the hexadecimal number 0xFFFF.

See also Other articles Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4