Forum Discussion
karkadil
Valued Contributor
You are right, try...except will not handle UI errors. I'd suggest you another solution:
def main(): while indexValue<len(list): launchApplication() performTask(list(indexValue)) indexValue = indexValue + 1 Log.Message("Process Completed") def GeneralEvents_OnLogError(Sender, LogParams): CloseOpenApplcaition() def launchApplication(): if(not isAppRunning()): startApp()
The main idea is that you call launchApp() function in every iteration of the while loop and start the app only if it is not started yet. In the OnLogError event handler you just close your app
SushantNfl
6 years agoOccasional Contributor
karkadil: The issue here is that the error occurs in performTask method after which generalevents_onlogerror is invoked and the control goes back to the step where error occured (which again causes failure since the application is closed by the onlogerror method).
I need to close then reopen the application and start the same (performTask) for the next item in the list.
Any suggestions, how can I achieve this?
Related Content
- 13 years agogreendarkness
Recent Discussions
- 2 hours agoSvetaG