Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error handling
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00662861
Message ID:
00662873
Vues:
19
Hi, John!

If an error occured within a method of an object always the error event of this object is "# one"!
BTW: This make sense following the object orientend paradigm of deployment of knowledge and responsibility!

What about using an specialised object for such error handling stuff?
xo = NEWOBJECT( "MyError" )

IF NOT xo.DoIt( "jskfh gfadj f" )
	WAIT WINDOW "Someting goes wrong!"
ELSE
	WAIT WINDOW "All is fine!"
ENDIF

IF NOT xo.DoIt( "SELECT 0" )
	WAIT WINDOW "Someting goes wrong!"
ELSE
	WAIT WINDOW "All is fine!"
ENDIF

RELEASE xo


DEFINE CLASS MyError AS Custom

lnError = 0

PROCEDURE Error
	LPARAMETERS tnError, tcMethod, tnLine
	This.lnError = m.tnError
ENDPROC

PROCEDURE DoIt
	LPARAMETERS tcCommand
	This.lnError = 0
	&tcCommand.
	RETURN ( This.lnError = 0 )
ENDPROC

ENDDEF
SeBaFlu
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform