Clean up try/catch in test code