| Discussion |
Remote Name: 188.8.131.52
> How I can trapp errors, while the app starts and no form is created?
That's a good question! I've made a number of improvements to my ErrHandler programs since the version of 5/23/01 currently available for download, and among the more recent extensions is a provision for a "global" ErrHandler. Your question makes me realize that I should update the download to my more recent version, so I'll try to make the time to do that soon.
In the meantime, I'll explain the gist of the approach. A Custom class ErrHandler (i.e. an ErrHCustom) would be instantiated in your main program, before launching any additional forms. This object assigns a reference to itself in a reserved global memory variable and establishes an ON ERROR ... command that invokes the generic errhoerr() UDF in the usual way. The logic of errhoerr.prg has been slightly revised to know about the new reserved memory variable for finding the global ErrHandler object. Thus any error that reaches the outer ON ERROR handler gets properly channeled to the global ErrHandler object, unless the active form supersedes it.
The reason I didn't add such a feature in the first place is purely a consequence of way that ErrHandler evolved, where I created sub-applications that had no control over the main program that invoked them. I realized that the general problem requires a solution to the global error handler issue, but I didn't have a good excuse to work on that aspect from the outset. Since then, I've had a chance to address this longstanding omission. I will post a message to this forum when I have updated the ErrHandler download, and I'll include a brief summary of the other enhancements in the new version.