Adding code to handle Facebook API errors.