From ac93a3934e0673ff286e3463ec54294b9066f11d Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Sun, 24 May 2015 10:57:03 -0700 Subject: [PATCH] More meaningful error if ET.parse runs into problems. Fixes #153. --- osc/core.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osc/core.py b/osc/core.py index 552127fa..dc70fefc 100644 --- a/osc/core.py +++ b/osc/core.py @@ -750,7 +750,13 @@ class Project: packages_file = os.path.join(self.absdir, store, '_packages') if os.path.isfile(packages_file) and os.path.getsize(packages_file): - return ET.parse(packages_file) + try: + result = ET.parse(packages_file) + except: + msg = 'Cannot read package file \'%s\'. ' % packages_file + msg += 'You can try to remove it and then run osc repairwc.' + raise oscerr.OscIOError(None, msg) + return result else: # scan project for existing packages and migrate them cur_pacs = []