Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CATCH TO this.Something
Message
 
À
30/06/2003 03:57:33
Matthias Will
BiCON Systemtechnik GmbH
Karlsruhe, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00804645
Message ID:
00805203
Vues:
22
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
Fil
Voir

Click here to load this message in the networking platform