General information
Title:
Why does Message(1) return bogus info in my error handler???
Hi,
I've noticed that for some reason the function message(1) in VFP 5 (I haven't tried it in VFP6) returns a bogus command line about 80% of the time. This is in an app where I have included the Debug info in the project.
I can recreate the error very easily. Lets say in the beginning of the program I have the following:
on error do errorhand with error(),message(),program(),lineno(),message(1)
Then in the middle of the program I type this:
lcBogusCommand="dsklfd;ajk;klja"
&lcBogusCommand
This will obviously return an error but instead of Message(1) returning the actual command line that caused the error, my messagebox appears with the following:
Error 16:Unrecogized command verb.
Line 42 of orphanrec
BETWEEN(lsterm_mo,0,11)
The last line is completely bogus, I think lsterm_mo is a variable in a different .prg file, not even in this project, but possibly in the same directory. Does anyone know why this happens? The actual error handler I use is below, very simple for a very simple program.
FUNCTION ErrorHand
LPARAMETER ernum,ercode,erprog,erline,ermsg
m.msgstr="Error "+alltrim(str(ernum))+": "+ercode+CHR(13)+ ;
"Line "+str(erline,5)+" of "+erprog+CHR(13)+ermsg
m.er=messagebox(m.msgstr,2+48+0,"Program Error")
cancel
return
ENDFUNC &&* ErrorHandler
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only