possibility of stopping the loop in on_error