From: "Bjorge, Erik C" <erik.c.bjorge@intel.com>
To: devel@edk2.groups.io
Cc: Ashley E Desimone <ashley.e.desimone@intel.com>,
Nate DeSimone <nathaniel.l.desimone@intel.com>,
Puja Pandya <puja.pandya@intel.com>,
Bret Barkelew <Bret.Barkelew@microsoft.com>,
Prince Agyeman <prince.agyeman@intel.com>
Subject: [edk2-staging/EdkRepo] [PATCH v1 2/3] EdkRepo: Improve error message with invalid XML
Date: Thu, 30 Apr 2020 15:52:53 -0700 [thread overview]
Message-ID: <ea1dc8dbe4eee099e476012cf34f26b2aa0a2f89.1588286715.git.erik.c.bjorge@intel.com> (raw)
In-Reply-To: <cover.1588286715.git.erik.c.bjorge@intel.com>
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 <erik.c.bjorge@intel.com>
Cc: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
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 <GeneralConfig>"
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
next prev parent reply other threads:[~2020-04-30 22:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-30 22:52 [edk2-staging/EdkRepo] [PATCH v1 0/3] Manifest parser cleanup Bjorge, Erik C
2020-04-30 22:52 ` [edk2-staging/EdkRepo] [PATCH v1 1/3] EdkRepo: Flake8 cleanup Bjorge, Erik C
2020-04-30 22:52 ` Bjorge, Erik C [this message]
2020-04-30 22:52 ` [edk2-staging/EdkRepo] [PATCH v1 3/3] EdkRepo: Refactoring private class members Bjorge, Erik C
2020-05-05 3:56 ` [edk2-staging/EdkRepo] [PATCH v1 0/3] Manifest parser cleanup Nate DeSimone
2020-05-05 3:59 ` Nate DeSimone
2020-05-05 17:04 ` Bjorge, Erik C
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ea1dc8dbe4eee099e476012cf34f26b2aa0a2f89.1588286715.git.erik.c.bjorge@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox