message Property (Visual Studio - JScript)
Returns an error message string.
errorObj.message
Arguments
- errorObj
Required. Instance of Error object.
Remarks
The message property returns a string that contains an error message associated with a specific error. Use the value that is contained in this property to alert a user to an error that you cannot or do not want to handle.
The description and message properties provide the same functionality. The description property provides backwards compatibility; the message property complies with the ECMA standard.
Example
The following example causes an exception to be thrown, and displays the message of the error.
try
{
var arr = new Array(-1);
}
catch(e)
{
print ("Error Message: " + e.message);
print ("Error Code: " + (e.number & 0xFFFF))
print ("Error Name: " + e.name);
}
The output of this code is:
Error Message: Array length must be zero or a positive integer
Error Code: 5029
Error Name: RangeError
Requirements
Applies To:
See Also
Reference
Change History
Date |
History |
Reason |
---|---|---|
July 2009 |
Modified the example. |
Content bug fix. |
March 2009 |
Modified the example. |
Information enhancement. |