I accepted this solution thinking I understand the solution but now that I want to code it, i don't understand how to check the value...
This is the soution:
In the try declare an int stepcompleted = 0;
Increment it after each call.
Check its value if an exception is called.
My code is in the related question. I dont know how to do this: Check its value if an exception is called.