catches exceptions and prints them out.