From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com []) by mx.groups.io with SMTP id smtpd.web10.61.1588287204056787193 for ; Thu, 30 Apr 2020 15:53:25 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: erik.c.bjorge@intel.com) IronPort-SDR: nJz6nfDA9yp/6CPEJ3uKC477UQEh0a2Eg70BmTFFGzoHCJMc7qmunqcCniTqDlqur7MVkXt0da VRlSZS2qp2sQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Apr 2020 15:53:25 -0700 IronPort-SDR: vCL+yeMo6jRrjqTsLIx2jLqSxR8ubxqO9fyK1b6g9xS8ud3bpnb+H47FbnRYiqTlZE+1FqAQwo +7Vs8jcD0k0w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,337,1583222400"; d="scan'208";a="368300818" Received: from ecbjorge-mobl1.amr.corp.intel.com ([10.212.184.120]) by fmsmga001.fm.intel.com with ESMTP; 30 Apr 2020 15:53:24 -0700 From: "Bjorge, Erik C" To: devel@edk2.groups.io Cc: Ashley E Desimone , Nate DeSimone , Puja Pandya , Bret Barkelew , Prince Agyeman Subject: [edk2-staging/EdkRepo] [PATCH v1 2/3] EdkRepo: Improve error message with invalid XML Date: Thu, 30 Apr 2020 15:52:53 -0700 Message-Id: X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The ETree exception contains additional information about the location of XML tag errors. Adding this information to the error message for better debugging support. Signed-off-by: Erik Bjorge Cc: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Bret Barkelew Cc: Prince Agyeman --- edkrepo_manifest_parser/edk_manifest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/edkrepo_manifest_parser/edk_manifest.py b/edkrepo_manifest_parser/edk_manifest.py index 7e5f0fb..2ec6cd1 100644 --- a/edkrepo_manifest_parser/edk_manifest.py +++ b/edkrepo_manifest_parser/edk_manifest.py @@ -51,7 +51,7 @@ GENERAL_CONFIG_MISSING_ERROR = "Unable to locate " SOURCELIST_EMPTY_ERROR = "Invalid input: empty values in source list" INVALID_PROJECTNAME_ERROR = "Invalid input: {} not found in CiIndexXml" UNSUPPORTED_TYPE_ERROR = "{} is not a supported xml type: {}" -INVALID_XML_ERROR = "{} is not a valid xml file" +INVALID_XML_ERROR = "{} is not a valid xml file ({})" class BaseXmlHelper(): @@ -59,8 +59,8 @@ class BaseXmlHelper(): self._fileref = fileref try: self._tree = ET.ElementTree(file=fileref) # fileref can be a filename or filestream - except Exception: - raise TypeError(INVALID_XML_ERROR.format(fileref)) + except Exception as et_error: + raise TypeError(INVALID_XML_ERROR.format(fileref, et_error)) self._xml_type = self._tree.getroot().tag if self._xml_type not in xml_types: -- 2.21.0.windows.1