Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Enclose every createobject with try catch?
Message
De
10/04/2018 13:59:57
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Enclose every createobject with try catch?
Divers
Thread ID:
01659292
Message ID:
01659292
Vues:
74
Hi,

Do you think it is a good practice to enclose every case where the code opens a form (sample code below) with the Try Catch?
local oForm
oForm = newobject('my_form','my_form_lib.vcx')
if type('oForm') = "O" and !isnull( oForm)
   oForm.show()
endif
If there is a problem, whatever, a run-time error happens on NewObject, so checking for type and isnull is of little help. If I enclose the entire code in Try Catch, the error will be displayed.

But I am not sure if adding so much code (in every case) is worth the 'trouble'

TIA
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform