Navigation: ABC Library Reference > FileManager > FileManager Methods >====== Throw (pass an error to the error handler for processing) ====== | |
Throw( [error id] ), VIRTUAL, PROC
Throw | Passes the specified error to the error handler object for processing. |
error id | A numeric constant, variable, EQUATE, or expression that indicates the error to process. If omitted, Throw processes the current error–that is , the error identified by the previous call to SetError or Throw. |
The Throw method passes the current (last encountered) error to the nominated error handler for processing, including FILEERROR() and FILEERRORCODE() values, then returns the severity level of the error.
Implementation:
The SetError method saves the specified error and underlying error state for use by the Throw method. See Error Class for more information on error ids and severity levels.
The Init method receives and sets the error handler object.
Return Data Type: BYTE
Example:
Access:Client.Next FUNCTION(BYTE HandleError)!Next function
CODE !with alternative error handling
LOOP
NEXT( SELF.File ) !get the next record
CASE ERRORCOD() !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