getErrorUserData()

Retrieves any variable as userData in the errClass object.

Synopsis

int getErrorUserData(errClass|dyn_errClass err, mixed userData);

Parameters

Parameter Description
err The errClass object in which the userData is set.
userData The userData that is returned.

Return value

Returns -1 on error and returns 0 on success.

Description

Retrieves any variable as userData in the errClass object.

The userData of the errClass can be set with the function setErrorUserData().

Example

float main()
{
  try
  {
    int dividend = 10;
    int divisor = 0;

    if (divisor == 0) //division by 0 error
    {
      errClass err = makeError("", PRIO_FATAL, ERR_CONTROL, 0, "Division by zero error");
      setErrorUserData(err, makeDynInt(dividend, divisor));
      throw(err);
    }

    return dividend / divisor;
  }

  catch
  {
    dyn_errClass exceptions = getLastException();
    dyn_int operationValues;      

    getErrorUserData(exceptions, operationValues);
    DebugN(getErrorText(exceptions), "Dividend = " + operationValues[1], "Divisor = " + operationValues[2]);
    return maxFLOAT();
  }
}

Assignment

Error Functions

Availability

User Interface and CONTROL.