Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ErrorHandler puzzler
Message
From
29/09/2008 15:46:01
 
 
To
12/09/2008 09:17:19
General information
Forum:
Visual FoxPro
Category:
Stonefield
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01346881
Message ID:
01351590
Views:
24
Hi Doug,

Sorry I didn't get back to you sooner but I got away from this for a bit. I've put the problem I described earlier (which I still have) and I'm trying to solve another issue which may or not be related. When I look in the class browser at the class definition code for the sferrormgr class I see the following.

*********************************************************************************************************
#INCLUDE "c:\msz\asol\stonefield\sferrormgr.h"
*
DEFINE CLASS sferrormgr AS sfcustom
	*-- The former ON ERROR handler.
	PROTECTED ccurrerror
	ccurrerror = ""
	*-- If .T., an error message isn't displayed when an error occurs.
	PROTECTED lsuppresserrors
	lsuppresserrors = .F.
	*-- Set to .T. when an error occurs.
	PROTECTED lerroroccurred
	lerroroccurred = .F.
	*-- The default title for the error message dialog.
	ctitle = "Error"
	*-- .T. to set ON ERROR to point to the ErrorHandler method.
	lsetonerror = .F.
	*-- The name of the file to log errors to.
	cerrorlogfile = "ERRORLOG.DBF"
	*-- .T. if we're logging errors to a file
	llogerrors = .T.
	*-- The name of the class to use to display messages.
	cmessageclass = "SFErrorMessage"
	*-- The name of the user.
	cuser = ""
	*-- .T. if "debug" should be an option
	lshowdebug = .F.
	*-- .T. if the error should be logged to a table (otherwise, it's logged to a text file)
	llogtotable = .T.
	*-- .T. if we're supposed to display errors and get the user's choice
	ldisplayerrors = .T.
	*-- .T. if we're quitting (public so other objects can check on the way out)
	lquit = .F.
	*-- The name of the program to return to if the user chooses Cancel
	creturntooncancel = "MASTER"
	*-- The library the class to display messages is in
	cmessageclasslibrary = "SFMgrs.vcx"
	*-- .T. if the error information has been saved in aErrorInfo
	PROTECTED lerrorinfosaved
	lerrorinfosaved = .F.
	builder = .F.
	Name = "sferrormgr"

	*-- An array containing error information; see the GetErrorInfo method documentation for the structure of this array.
	DIMENSION aerrorinfo[1]
****************************************************************************************************************
Note that the 3rd PROTECTED field down is lerroroccurred which is followed by .lerroroccurred = .F.

If I put anycode in any methods of this class this leads to problems that seem related to a rebuild of the .app. For instance, I put a WAIT WINDOW 'HELLO WORLD' in the init(), save it and build an app. Before testing I examined the code once more in the CLASS BROWSER. This is what I see.

****************************************************************************************************************
#INCLUDE "c:\msz\asol\stonefield\sferrormgr.h"
*
DEFINE CLASS sferrormgr AS sfcustom

	*-- The former ON ERROR handler.
	PROTECTED ccurrerror
	ccurrerror = ""
	*-- If .T., an error message isn't displayed when an error occurs.
	PROTECTED lsuppresserrors
	lsuppresserrors = .F.
	*-- The default title for the error message dialog.
	ctitle = "Error"
	*-- .T. to set ON ERROR to point to the ErrorHandler method.
	lsetonerror = .F.
	*-- The name of the file to log errors to.
	cerrorlogfile = "ERRORLOG.DBF"
	*-- .T. if we're logging errors to a file
	llogerrors = .T.
	*-- The name of the class to use to display messages.
	cmessageclass = "SFErrorMessage"
	*-- The name of the user.
	cuser = ""
	*-- .T. if "debug" should be an option
	lshowdebug = .F.
	*-- .T. if the error should be logged to a table (otherwise, it's logged to a text file)
	llogtotable = .T.
	*-- .T. if we're supposed to display errors and get the user's choice
	ldisplayerrors = .T.
	*-- .T. if we're quitting (public so other objects can check on the way out)
	lquit = .F.
	*-- The name of the program to return to if the user chooses Cancel
	creturntooncancel = "MASTER"
	*-- The library the class to display messages is in
	cmessageclasslibrary = "SFMgrs.vcx"
	*-- .T. if the error information has been saved in aErrorInfo
	PROTECTED lerrorinfosaved
	lerrorinfosaved = .F.
	lerroroccurred = .F.
	builder = .F.
	Name = "sferrormgr"

	*-- An array containing error information; see the GetErrorInfo method documentation for the structure of this array.
	DIMENSION aerrorinfo[1]
	PROTECTED lerroroccurred
**************************************************************************************************************

Notice that the PROTECTED lerroroccurred is now at the end of the class definition but the lerroroccurred = .F. is prior to that. When I run the app and it hits an error I get 'Property LERROROCCURRED' is not found. Am I not understanding something about protected properties and methods or is it something about 'builderd' that I don't know.

Melanie


>Hi Melanie.
>
>>4. The first is 'Object oError is not found' followed by 'Property lerroroccurred is not found' and so on.
>
>It sounds like an error is occurring somewhere (which you may want to eliminate, but that's another topic) and although you defined an error handler that references oError, you didn't define oError to be PUBLIC (or PRIVATE in a top-level program), so it's out of scope. As a result, when the error occurs and VFP tries to execute the error handler, it can't find oError. The subsequent errors likely occur because of the first one.
>
>Doug
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform