| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > FileManager > FileManager Methods >====== ThrowMessage (pass an error and text to the error handler) {{c6h0009.jpg|C6H0009.jpg}} ====== | [[throw pass an error to the error handler for processing .htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[tryfetch try to get a specific record by key value .htm|{{btn_next_n.gif|Next page}}]] | | || **ThrowMessage( **//error id, text //**), VIRTUAL, PROC** {{blk2blue.jpg|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 initialize the filemanager object .htm|Init]]