More detailed error output on corrupt UID mapping files

This function will need much more "robustifying", but the very least we
can do is to print the file name and line that are giving trouble.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Sebastian Spaeth 2011-05-02 11:44:19 +02:00 committed by Nicolas Sebrecht
parent fb3abaa6a5
commit 50f0fbb421
2 changed files with 7 additions and 1 deletions

View File

@ -16,6 +16,8 @@ New Features
Changes Changes
------- -------
* Give more detailed error when encountering a corrupt UID mapping file.
Bug Fixes Bug Fixes
--------- ---------

View File

@ -45,7 +45,11 @@ class MappingFolderMixIn:
line = file.readline() line = file.readline()
if not len(line): if not len(line):
break break
line = line.strip() try:
line = line.strip()
except ValueError:
raise Exception("Corrupt line '%s' in UID mapping file '%s'" \
%(line, mapfilename))
(str1, str2) = line.split(':') (str1, str2) = line.split(':')
loc = long(str1) loc = long(str1)
rem = long(str2) rem = long(str2)