wrap retries in a try catch block