>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.