added printException method and updated throwException method to use the exception method