Add try except around error printing