Returns the next error object, if one exists.
PSErrorClass objects
errorobject.GetNextError( )
Argument |
Description |
---|---|
errorobject |
A variable that contains a reference to an instance of PSErrorClass |
PSErrorClass object. If multiple error objects exist, returns an instance of PSErrorClass for the next error object. If no more error objects exist, it returns null.
At runtime, GetNextError has the following behavior:
Application server |
Runtime behavior |
---|---|
ASP |
Returns the next error object |
JSP |
Returns the next error stored in the named error object |
The following example for an ASP target connects to a database and retrieves some data. If an error occurs, it uses GetNextError to access the list of error objects. For each error object, it writes out the error code and message text:
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();
{
while ( errobj != null )
{
str = errobj.GetCode() + " " + errobj.GetMessage();
psDocument.WriteLn ( str );
errobj = errobj.GetNextError();
}
}