changeset 4:ae0fb567f459

Report error but don't crash when a solution points to a missing project.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 24 Oct 2019 11:15:37 -0700
parents 949c4f536f26
children bac97082e229
files scripts/vsutil.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/vsutil.py	Thu Oct 24 11:14:39 2019 -0700
+++ b/scripts/vsutil.py	Thu Oct 24 11:15:37 2019 -0700
@@ -281,7 +281,14 @@
 
         abspath = self.abspath
         logger.debug(f"Loading project {self.name} ({self.path}) from: {abspath}")
-        tree = etree.parse(abspath)
+        try:
+            tree = etree.parse(abspath)
+        except (FileNotFoundError, OSError) as ex:
+            logger.debug(f"Error loading project {self.name}: " + str(ex))
+            self._itemgroups = {}
+            self._propgroups= {}
+            return
+
         root = tree.getroot()
         if _strip_ns(root.tag) != 'Project':
             raise Exception(f"Expected root node 'Project', got '{root.tag}'")