Hi all,
I have the following setup containing 2 loops and 2 Try/Catch blocks:
Outer List Iterator Loop Start
Try
Try
Inner Ini File Iterator Start
"###Do something"
Inner Ini File Iterator End
Catch
Handle Exception
Raise Exception for outer Try/Catch
Finally
End
Catch
Finally
End
Outer List Iterator Loop End
When the action "###Do something" fails I want the outer loop to continue with the next iteration, which uses a different Ini File for the inner Ini File Iterator. The inner Ini File Iterator loop shall process a specific Section in the Ini file one by one.
However, after a previous error in "###Do something" the inner loop iterator does not start at the very first entry in the Ini file, instead, it seems to remember the iterator position (i.e. the line in the corresponding Ini file's section) where it was when the error in "###Do something" occurred. Since I'm leaving the inner loop using Try/Catch I expect the inner loop to start at the very first entry again.
Isn't the loop exited when it's embedded in a Try/Catch block that throws an error?
Can I somehow reset the internal iterator position manually?
Thanks for your help!
I created a small project to reproduce this behaviour. However, I can’t attach it (or any file!) to this thread, it’s always refused with the error “File type is not allowed”
Hi,
Please feel free to email the sample project to support@finalbuilder.com.
In the meantime however I have found a bug which will be affecting what your attempting to achieve. The iterator in this case is not resetting back to the start after an exception is caused. I will fix this ASAP for you and update this post with a build when it is ready.
Hi,
The updated build is located here:
http://downloads.finalbuilder.com/downloads/finalbuilder/800/FB800_1657.exe
Note that you should only require one set of try…catch…finally…end. Handle the exception and allow the outer loop to tick over again. There is no need to re-raise the exception to the outer loop.
Thanks for the quick response and the hot fix, it works fine in my test project!
I have nested Try/Catches for design reasons, it’s easier to understand what’s going on and simplifies maintenance.