Add error logging.