Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error Trapping and the Error Method
Message
From
04/01/2002 12:48:33
 
 
To
04/01/2002 09:43:53
Bruce Gordon
Wicks Broadcast Solutions, Llc
Vienna, Virginia, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00600738
Message ID:
00600841
Views:
14
>Help? I’m very confused. I would have thought the class’s Error method would fire regardless when a VFP error occurred in the class code.

If an error occurs on a control and the control has actual code in the Error() method, the Error() method is called. If there is no Error() code (IOW, the method is there, but its blank) then ON ERROR takes care of it.

Also keep in mind that the Error() method is control specific. For exmaple, if an error occurs on a command button, and there is no code in the Command.Error() but there is in the Form.Error(), it does NOT run the Form.Error(). Instead, it will call ON ERROR. EG:
oForm = CREATEOBJECT('myerrorform')
oForm.Show(1)
DEFINE CLASS myerrorform as form 
	ADD OBJECT command1 AS commandbutton
	PROCEDURE error(x, y, z)
	MESSAGEBOX('An error has occured')
	ENDPROC 
 
	PROCEDURE Click
	WAIT WINDOW .t.
	ENDPROC 
 
	PROCEDURE command1.click
	WAIT WINDOW .t.
	ENDPROC 
	
ENDDEFINE
If ON ERROR gets to handle the error, and ON ERROR is blank, VFP's standard error handler takes it.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform