GetMessage

Description

Returns the message associated with the current error object.

Applies to

PSErrorClass objects

Syntax

errorobject.GetMessage( )

Argument

Description

errorobject

A variable that contains a reference to an instance of PSErrorClass

Returns

String

Usage

At runtime, GetMessage has the following behavior:

Application server

Runtime behavior

ASP

Returns the most recent error message, which is obtained by accessing the Description property of the Error object

JSP

Returns the most recent error message stored in the named error object

Examples

Example 1

The following example for an ASP target connects to a database and retrieves some data. If an error occurs, it uses GetMessage to get the error message:

myconnect =
		psServer.GetConnection("SalesDBConnection");
if ( myconnect.GetError() == null )
		{
		myquery = "Select * from sales"; 
		mycursor = myconnect.CreateCursor( myquery );
		if ( myconnect.GetError() == null )
			{
			// Process the retrieved data
			}
		else dberror = true;
		}
else dberror = true;
	if ( dberror == true )
			{
			errobj = myconnect.GetError();
			str = errobj.GetCode() + " " +
				errobj.GetMessage();
			psDocument.Write ( str );
 			}