User Tools

Site Tools


throw_pass_an_error_to_the_error_handler_for_processing_.htm
Navigation:  ABC Library Reference > FileManager > FileManager Methods >====== Throw (pass an error to the error handler for processing) C6H0009.jpg ====== Previous pageReturn to chapter overviewNext page

Throw( [error id] ), VIRTUAL, PROC

blk2blue.jpg

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

See Also: Init, SetError

throw_pass_an_error_to_the_error_handler_for_processing_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1