Error handling

Error handling

Postby Natter » Tue Apr 02, 2024 4: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?
Natter
 
Posts: 1226
Joined: Mon May 14, 2007 9:49 am

Re: Error handling

Postby paquitohm » Tue Apr 02, 2024 6: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
paquitohm
 
Posts: 281
Joined: Fri Jan 14, 2022 8:37 am

Re: Error handling

Postby Natter » Tue Apr 02, 2024 6:53 pm

Thanks. However, it is difficult to understand without an example.
Natter
 
Posts: 1226
Joined: Mon May 14, 2007 9:49 am

Re: Error handling

Postby paquitohm » Tue Apr 02, 2024 8:03 pm

Modifying errsysw.prg
An approach:

Code: Select all  Expand view  RUN
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)

........................................
 
paquitohm
 
Posts: 281
Joined: Fri Jan 14, 2022 8:37 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 76 guests