GetError (return the current error ID)

Top  Previous  Next

 

GetError

The GetError method returns the current error ID for the managed file. See Error Class for more information on error IDs.

Return Data Type:     SIGNED

Example:

PROGRAM

INCLUDE('ABFILE.INC')                     !declare FileManager class

MAP                                       !program map

LogError   (STRING filename, SHORT error)  !prototype LogError procedure

END

 

GlobalErrors ErrorClass                    !declare GlobalErrors object

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

             END

 

ErrorLog  FILE,DRIVER(‘TopSpeed’),PRE(LOG),CREATE,THREAD!declare log file

Record     RECORD

Date        LONG

Time        LONG

File        STRING(20)

ErrorId     SHORT

          END

         END

CODE

!program code

IF Access:Client.Open()           !if error occurs

 LogError(Access:Client.GetName(),Access:Client.GetError())!log name and error id

END

!program code

 

LogError PROCEDURE(STRING filename, SHORT error)

CODE

LOG:Date   = TODAY()              !store date

LOG:Time   = CLOCK()              !store time

LOG:File   = filename             !store filename

LOG:ErrorId = error               !store error id

ADD(ErrorLog)                     !write logfile