Mark,
You'll be better off dumping all your objects in the error handler. Also the program stack data via astackinfo() will help you figure out exactly where the code was executing prior to the error.
>I need to run this in an error handler:
>LIST OBJECTS LIKE ObjName TO FILE (lcTempFile) NOCONSOLE
>So I need to know what is a name of a form object.