An error handler needs to give as much information about the current state of the software as possible to find the reason for errors.
Some of the information can be found in VFP by commands like LIST MEMORY and LIST STATUS.
I also like to have the values of each control in the active form.
For that I recursively scan all controls in the form, finding controls that have a property called value and printing that out. Pageframes and Containers are recursed into. For grid I select the grid record source and then print the value of the control source of each column.
The code in my error handler is (Have not understood how to put indents in code)
FOR lnCounter=1 TO AMEMBERS(laScrProp,_screen.activeform,0,'U')