Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reset an error
Message
 
 
À
27/02/2003 15:12:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00758998
Message ID:
00759040
Vues:
33
No but you can temporarily over-ride your regular ON ERROR routine:
local lcOldError
lcOldError = ON('ERROR')
ON ERROR Do MyErrorProc

*!* your loop here

ON ERROR &lcOldError

PROC MyErrorProc
   THIS.lError = .t.
   AERROR(THIS.aErrorInfo)
ENDPROC
PROC ResetErrorInfo
   THIS.lError = .f.
   DIMENSION THIS.aErrorInfo[1]
   THIS.aErrorInfo = []
ENDPROC
If this is not an object, then make the lError and aErrorInfo PRIVATE or PUBLIC vars in your loop code. If you make them PRIVATE, you need to initalize them with values before you start your loop otherwise the will not be visible in the MyErrorProc or ResetErrorInfo procedures.

>Problem that I cannot modify ON ERROR routine.
>
>Thanks, Mark
>>>I am running some code in the loop. A loop can create a system error. I'd like to reset errors between the loops. So when next loop is running and I am checking for errors (AERRORS()) it won't pick up the error from a prev. loop.
>>>
>>>Thanks, Mark
>>
>>You can't. The best you can do is have an lError property and an aErrorInfo array to store the info in. After you check the error, reset the lError property [or memvar] to .F., and redimension the array back to 1 and set its contents to []. When an error occurs, have your ON ERROR proc set the lError prop to .T. and populate the aErrorInfo array with AERROR().
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform