Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

message Property (Visual Studio - JScript)

Returns an error message string.



Required. Instance of Error object.

The message property is a string containing an error message associated with a specific error. Use the value contained in this property to alert a user to an error that you can't or don't want to handle.

The description and message properties refer to the same message; the description property provides backwards compatibility, while the message property complies with the ECMA standard.

The following example causes an exception to be thrown and displays the message of the error.

    var arr = new Array(-1);
    print ("Error Message: " + e.message);
    print ("Error Code: " + (e.number & 0xFFFF))
    print ("Error Name: " + e.name);

The output of this code is as follows.

Error Message: Array length must be zero or a positive integer
Error Code: 5029
Error Name: RangeError

Community Additions

© 2015 Microsoft