I'm not sure that's possible, since for raising that error, I have to wait for the whole loop to finish. Can you give some code for the approach you suggested?