move some code into a try/catch