Mercurial > vim-crosoft
comparison scripts/vsutil.py @ 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 | 4ba6df1b2f97 |
comparison
equal
deleted
inserted
replaced
| 3:949c4f536f26 | 4:ae0fb567f459 |
|---|---|
| 279 | 279 |
| 280 ns = {'ms': 'http://schemas.microsoft.com/developer/msbuild/2003'} | 280 ns = {'ms': 'http://schemas.microsoft.com/developer/msbuild/2003'} |
| 281 | 281 |
| 282 abspath = self.abspath | 282 abspath = self.abspath |
| 283 logger.debug(f"Loading project {self.name} ({self.path}) from: {abspath}") | 283 logger.debug(f"Loading project {self.name} ({self.path}) from: {abspath}") |
| 284 tree = etree.parse(abspath) | 284 try: |
| 285 tree = etree.parse(abspath) | |
| 286 except (FileNotFoundError, OSError) as ex: | |
| 287 logger.debug(f"Error loading project {self.name}: " + str(ex)) | |
| 288 self._itemgroups = {} | |
| 289 self._propgroups= {} | |
| 290 return | |
| 291 | |
| 285 root = tree.getroot() | 292 root = tree.getroot() |
| 286 if _strip_ns(root.tag) != 'Project': | 293 if _strip_ns(root.tag) != 'Project': |
| 287 raise Exception(f"Expected root node 'Project', got '{root.tag}'") | 294 raise Exception(f"Expected root node 'Project', got '{root.tag}'") |
| 288 | 295 |
| 289 self._itemgroups = {} | 296 self._itemgroups = {} |
