FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Error handling
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Error handling
Posted: Tue Apr 02, 2024 04:19 PM
Hi,

If an error occurs, the error.log file is saved automatically.
How do I make sure that when an error occurs, some of my functions are executed and an error.log file is created?
Posts: 318
Joined: Fri Jan 14, 2022 08:37 AM
Re: Error handling
Posted: Tue Apr 02, 2024 06:41 PM

Hello,

You can do it by recording an error log-min1.log at the beginning and then an errorlog-min2.log where more things are recorded incrementally. In errorlog-min1.log the callbacks will be recorded and in errorlog-min2.log, in addition to the callbacks, the calling program, the date, etc. will be recorded.

Greetings

Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Error handling
Posted: Tue Apr 02, 2024 06:53 PM

Thanks. However, it is difficult to understand without an example.

Posts: 318
Joined: Fri Jan 14, 2022 08:37 AM
Re: Error handling
Posted: Tue Apr 02, 2024 08:03 PM
Modifying errsysw.prg
An approach:
Code (fw): Select all Collapse
FUNCTION ErrorDialog(e)

// At top in errordialog() function, 1st recording
c:= "Description error: "+ e:description
c+= Procname(1)+ CRLF+ ProcName(2)+ ProcName(3)
memoWrit("ErrorMin1.log", c)

.........................

// 2nd recording. More info
c+= "Exe Name: "+ ExeName()+ CRLF
c+= "User: "+ UserName() + CRLF
c+= "User program: "+ UserProgram()
memoWrit("ErrorMin2.log", c)

........................................

Continue the discussion