From 2ed1c357a06bb7de2e1eacc3feaebe627c54be3b Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Mon, 2 May 2011 11:44:19 +0200 Subject: [PATCH] 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 Signed-off-by: Nicolas Sebrecht --- Changelog.draft.rst | 2 ++ offlineimap/folder/UIDMaps.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Changelog.draft.rst b/Changelog.draft.rst index 0a85888..2b109a3 100644 --- a/Changelog.draft.rst +++ b/Changelog.draft.rst @@ -16,6 +16,8 @@ New Features Changes ------- +* Give more detailed error when encountering a corrupt UID mapping file. + Bug Fixes --------- diff --git a/offlineimap/folder/UIDMaps.py b/offlineimap/folder/UIDMaps.py index 43b28e4..e87e21e 100644 --- a/offlineimap/folder/UIDMaps.py +++ b/offlineimap/folder/UIDMaps.py @@ -51,7 +51,11 @@ class MappingFolderMixIn: line = file.readline() if not len(line): 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(':') loc = long(str1) rem = long(str2)