Handle exceptions and print traceback