Placed optimization call in a try-catch