Partager via


message Property (Windows Scripting - JScript)

 

Returns an error message string.

Syntax

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.

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

The following example causes a TypeError exception to be thrown and displays the name of the error and its message.

try
{
    // Cause an error.
    var x = y;
}
catch(e)
{
    document.write ("Error Message: " + e.message);
    document.write ("<br />");
    document.write ("Error Code: ");
    document.write (e.number & 0xFFFF)
    document.write ("<br />");
    document.write ("Error Name: " + e.name);
}

The output of this code is as follows.

Error Message: 'y' is undefined
Error Code: 5009
Error Name: TypeError

Requirements

Version 5

Applies To: Error Object (Windows Scripting - JScript)

Change History

Date

History

Reason

March 2009

Modified remarks and example.

Information enhancement.

See Also

description Property (Windows Scripting - JScript)
name Property (Windows Scripting - JScript)