exit loop with lambda error