Subject Re: ON ERROR
From Mervyn Bick <invalid@invalid.invalid>
Date Thu, 24 Feb 2022 10:25:08 +0200
Newsgroups dbase.getting-started

On 2022/02/24 01:55, Steve wrote:
> I have some ON ERROR code to catch errors. I run SET ALTE TO a file and SET ALTE ON to catch ? commens in the code.
>
> E.G., my starting prg starts out with SET ALTE TO a file and SET ALTE ON. It also includes a class ErrHandler for handlin errros with a function:
> function globalErrorTrap(cPrg,nLine,nError,cMsg)
>
> This function has a number of lines of code to write info to the SET ALTE TO file like:
> ? "Ready to run..."
>
> To allow me to track progress thru the code. But, none of these comments are writing out to the SET ALTE TO file. These comments do write out when not in the error trap but not while in the error trap.
>
> Can someone let me know what I am doing wrong?

It's probably 30 years since I used XDML for anything other than "quick
and dirty" code but if there is a print statement (?) in the function
globalErrorTrap() it should write to the file.  This suggests that the
function isn't being called when you program flags an error.
Alternatively one of your parameters contains a null value.  If you
concatenate the parameters before printing this would result in a blank
line.

Add a msgbox as the first line in the function to test this.  Depending
on whether the message box is triggered on not will determine the way
forward.

Mervyn.