Catch exceptions in wait_until method