Retry a block of code that might fail due to temporary errors.