Refactoring try{}catch{}