Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why does Message(1) return bogus info in my error handler???
Message
From
22/07/1999 21:56:05
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Why does Message(1) return bogus info in my error handler???
Miscellaneous
Thread ID:
00245133
Message ID:
00245133
Views:
52
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
Map
View

Click here to load this message in the networking platform