User Tools

Site Tools


throwmessage_pass_an_error_and_text_to_the_error_handler_.htm
Navigation:  ABC Library Reference > FileManager > FileManager Methods >====== ThrowMessage (pass an error and text to the error handler) C6H0009.jpg ====== Previous pageReturn to chapter overviewNext page

ThrowMessage( **//error id, text //), VIRTUAL, PROC**

blk2blue.jpg

ThrowMessage Passes the specified error and text to the error handler object for processing.
error id A numeric constant, variable, EQUATE, or expression that indicates the error to process.
text A string constant, variable, EQUATE, or expression to include in the error message.

The **ThrowMessage **method passes the specified error, including FILEERROR() and FILEERRORCODE() values, and text to the error handler object for processing, then returns the severity level of the error. See Error Class for more about error ids and severity levels.

**Implementation: **The Init method receives and sets the error handler. The incorporation of the text //into the error message depends on the error handler. See //Error Class.

Return Data Type:     BYTE

Example:

GlobalErrors ErrorClass                            !declare GlobalErrors object

Access:Client CLASS(FileManager)                   !derive Access:Client object

ValidateField  PROCEDURE(UNSIGNED Id),BYTE,VIRTUAL !prototype validation

**              END**

**Client  FILE,DRIVER('TOPSPEED'),PRE(CLI),THREAD                 **

IDKey   KEY(CLI:ID),NOCASE,OPT,PRIMARY

Record   RECORD,PRE()

ID        LONG

Name      STRING(20)

StateCode STRING(2)

**         END**

**        END**

** CODE**

** !program code**

Access:Client.ValidateField FUNCTION(UNSIGNED Id)

** CODE**

** IF ID = 3                   !validate statecode (3rd) field**

**  IF ~CLI:StateCode          !if no statecode, **

**                             !pass error & text to error handler**

**   RETURN Access:Client.ThrowMessage(Msg:RequiredField,'StateCode')**

**  END**

** END**

** RETURN Level:Notify**

**See Also:     **Init

throwmessage_pass_an_error_and_text_to_the_error_handler_.htm.txt · Last modified: by 127.0.0.1