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
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement