SetError (save the specified error and underlying error state)

Top  Previous  Next

 

SetError( error id )

SetError

Saves the specified error and the underlying error state for use by the Throw method, etc.

error id

A numeric constant, variable, EQUATE, or expression that identifies the error. See Error Class for more information on error id.

The SetError method saves the specified error and underlying error state for use by the Throw method, etc.

Example:

Access:Client.Next FUNCTION(BYTE HandleError) !Next function

CODE                                        !with alternative error handling

LOOP

 NEXT( SELF.File )                          !get the next record

 CASE ERRORCODE()                           !check for error conditions

 OF BadRecErr OROF NoError

  RETURN Level:Benign

 OF IsHeldErr                               !if record is HELD by another

  SELF.SetError(Msg:RecordHeld)             !make RecordHeld the current error

  IF HandleError                            !if interactive error handling

   RETURN SELF.Throw()                      !pass current error to error handler

  ELSE                                      !otherwise (silent error handling)

   RETURN Level:Notify                      !return error code to caller

  END

 END

END

See Also:     Throw