Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Stopping a function from my error handler...
Message
 
 
À
19/10/2000 14:40:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00431640
Message ID:
00432078
Vues:
29
You can get the name of everything in the call stack using Program(). Program(-1) will return the program level number you are. If you use program(program(-1)-2) in the error routine, you can get the program that was running just before the program that caused the error. You can then use macro expansion or name expressions in the RETURN TO.

HTH.

>Great!
>
>But how can I know the name of the procedures that are available to go back to? For example, if I get an error in the click event of a button that's on a certain form. If I'm now in my error handler and I want to go back to looking at my form (forgetting to execute all the code after the error in my click event), how can I do this?
>
>Thanks again!
>
>>Check out the RETURN TO syntax for the RETURN keyword. You can specify a program within the stack to return to. If you specify a program/procedure before the erroring one, it should return without executing any other code.
>>
>>HTH.
>>
>>>Hi,
>>>
>>>I'm trying to write an error handler function that'll stop a program that produced certain types of errors. I don't want my app to stop or exit, I only want to stop the execution of the function that caused the error after having displayed an error message. Here's how I wrote my function:
>>>
>>>
>>>FUNCTION ErrorHandler(nError,cMethod,nLine)
>>>LOCAL lcErrorMsg,lcCodeLineMsg
>>>
>>>   *Some code here
>>>   IF nError = 13 THEN &&Table not opened
>>>      *Code that sends a message and then stops the execution
>>>      *of the calling method
>>>   ENDIF
>>>ENDFUNC
>>>
>>>
>>>So, in this particular case, I want my function to stop whenever I can't open a table (because everything else is going to fail if the table is not opened properly).
>>>
>>>Thanks in advance, Stephane.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform