Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Try Catch with Catch 2 times
Message
From
01/06/2021 18:18:28
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01680817
Message ID:
01680876
Views:
46
>Could someone create a sample code with Try Catch such that Try will trigger an error and then Catch will trigger an error such that it would go back to the Catch again? That is, where the Catch code fires twice. I have had that condition once (I saw it in the debugger) but forgot how the error in my code triggered it.
>

Not tested but you might try:
TRY
*  some code that causes an exception to be raised 
CATCH TO loException
   TRY
*       some code that causes a second exception to be raised 
   CATCH TO loSubException
      THROW loSubException
   ENDTRY
ENDTRY
The THROW command is supposed to send the error to the next higher level of the TRY-CATCH-ENDTRY. So the above might do what you are looking for in terms of nesting the TRY command.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform