getLastError()

Gets the last error that occurred.

Synopsis

dyn_errClass getLastError();

Parameters

Parameter Description
none -

Return value

The function returns a list of error classes.

Note that when using the function getLastError(), use it directly after the function call of the function whose errors you want to receive since the function getLastError returns the errors of the last function call.

Description

Returns the list of error classes that occurred during processing of the functions.

The following functions set the error class list in the event of an error:

  • alertConnect()

  • alertDisconnect()

  • alertGetPeriod()

  • alertSet()

  • checkQuery()

  • checkScript()

  • dpAliasToName()

  • dpAttributeType()

  • dpConnect()

  • dpCreate()

  • dpDelete()

  • dpDisconnect()

  • dpElementType()

  • dpExists()

  • dpGetAlias()

  • dpGetAsynch()

  • dpGetComment()

  • dpGetPeriod()

  • dpGetStatusBit()

  • dpNames()

  • dpQuery()

  • dpQueryConnectAll()

  • dpQueryConnectSingle()

  • dpQueryDisconnect()

  • dpRename()

  • dpSet()

  • dpSetAlias()

  • dpSetTimed()

  • dpSetTimedWait()

  • dpSetWait()

  • dpSubStr()

  • dpTypeName()

  • dpTypes()

  • getAllDpAliases()

  • getSystemNames()

  • setDpAlias()

  • dpWaitForValue()

  • getVariable()

The following functions do NOT set the error class list in the event of an error:

  • dpSetErrorCheck()

  • dpSetDynErrorCheck()

  • getACount()

  • getAIdentifier()

  • pvssRangeCheck()

Example

The following example sets the error class list for a dpWaitForValue event.

main()
{
  time t = 1;
  dyn_errClass err;
  dyn_string wait;
  dyn_string ret;
  dyn_anytype conditions;
  dyn_anytype target;
  conditions[1] = false;
  wait = makeDynString("test.b:_original.._value");
  ret = makeDynString("test_0.b:_original.._value");
  dpWaitForValue(wait,conditions,ret,target,t);
  err = getLastError(); //test whether an error occurred
  if(dynlen(err) > 0)
  {
    errorDialog(err);
    // open dialog box with errors
    throwError(err); // write errors to stderr
  }
  else
  {
    DebugN("OK"); //no errors
  }
}

Assignment

Errors

Availability

CTRL