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
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