Add function to properly report critical errors.