number Property
Returns or sets the numeric value associated with a specific error.
object.number
The following example causes an exception to be thrown, and displays the error number.
function getAge(age) {
if(age < 0)
throw new Error(100)
print("Age is "+age+".");
}
// Pass the getAge an invalid argument.
try {
getAge(-5);
} catch(e) {
// Extract the error code from the error number.
print(e.number & 0xFFFF)
}
The output of this code is:
100
Show: