would be nice if there was a failure context which could hold the loop counter