Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CATCH TO this.Something
Message
 
To
30/06/2003 03:57:33
Matthias Will
BiCON Systemtechnik GmbH
Karlsruhe, Germany
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00804645
Message ID:
00805203
Views:
23
Hi Matthias !


From VFP help

"TRY
[ tryCommands ]
[ CATCH [ TO VarName ] ....."

"If an error occurs, Visual FoxPro stores a reference to an Exception object specified by the VarName memory variable in the TO VarName clause."

In VFP memory variables and properties are internally managed in diferent way so if syntax is To Varname we should to use memory variable.

It seems however that one can use (in catch to statment " a property that exists.

Try this:

*----------------------------
clear
x = CREATEOBJECT("sample1")
x.samplemethod()
y = CREATEOBJECT("sample2")
y.samplemethod()


DEFINE CLASS sample1 as Custom
PROCEDURE samplemethod
TRY
? "sample 1"
Fiji
CATCH TO this.oLastException
? "error"
ENDTRY
ENDPROC
ENDDEFINE

DEFINE CLASS sample2 as Custom
oLastException = .NULL.
PROCEDURE samplemethod
TRY
? "sample 2"
Fiji
CATCH TO this.oLastException
? "error" , this.oLastException.errorno
ENDTRY
ENDPROC
ENDDEFINE
*----------------------------



Best regards
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform