Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Try/Catch
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00802432
Message ID:
00802753
Vues:
18
Now thats a way of stating it that really helps! Maybe that
light is starting to turn on in my head!

Thanks very much,
Eddie

>I would suggest to put all your code inside the TRY/CATCH block. Also, notice that CATCH has the option to "filter" errors, so that you can catch errors that you know how to handle (e.g. cannot open file for exclusive use) and let someone else (e.g.the caller program) deal with other errors.
>
>I usually discourage people from using CATCH WHEN .T. since this will "eat" all errors, and your code most likely will not know how to deal with all errors. However, if you do add a CATCH WHEN .T. -- try to rethrow the exeption so that the caller program can deal with it (see commented code below).
>
>
>try
>    use customer excl
>    close all
>    do backups
>catch TO oEx WHEN oEx.ErrorNo=3
>    messagebox('Unable to Open Files Exclusive')
>* catch
>*   messagebox('something else went wrong')
>*   throw
>endtry
>
>
>SET MARKETING ON
>Here is yet another reference on Try/Catch:
>http://www.levelextreme.com/magazine/june2003/page28.asp
>SET MARKETING OFF
If Bill Gates had a penny for every time windows crashed he'd be... Oh wait he does!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform