Page 1 of 1

Error handling

PostPosted: Tue Apr 02, 2024 4:19 pm
by Natter
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?

Re: Error handling

PostPosted: Tue Apr 02, 2024 6:41 pm
by paquitohm
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

Re: Error handling

PostPosted: Tue Apr 02, 2024 6:53 pm
by Natter
Thanks. However, it is difficult to understand without an example.

Re: Error handling

PostPosted: Tue Apr 02, 2024 8:03 pm
by paquitohm
Modifying errsysw.prg
An approach:

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

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