description Property

Returns or sets the descriptive string associated with a specific error.

object.description

Arguments

  • object
    Required. An instance of an Error object.

Remarks

The description 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.

The description and message properties provide the same functionality; the description property provides backward compatibility, while the message property complies with the ECMA standard.

Example

The following example illustrates the use of the description property.

try
{
    var arr = new Array(-1);
}
catch(e)
{
    print ("Error Message: " + e.message);
    print ("Error Description: " + e.description);
    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 Description: Array length must be zero or a positive integer
Error Code: 5029
Error Name: RangeError

Requirements

Version 5

Applies To:

Error Object

See Also

Reference

number Property

message Property (Visual Studio - JScript)

name Property

Change History

Date

History

Reason

July 2009

Modified example.

Content bug fix.

March 2009

Modified example and remarks.

Information enhancement.