From 661b72e0170140d403c9adeea00372cd233eaf29 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 10 Sep 2010 12:38:59 -0600 Subject: [PATCH] SONY driver: Nicer error message when SONY XML db is corrupted --- src/calibre/devices/prs505/sony_cache.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/devices/prs505/sony_cache.py b/src/calibre/devices/prs505/sony_cache.py index f05d9c0311..879f86d66a 100644 --- a/src/calibre/devices/prs505/sony_cache.py +++ b/src/calibre/devices/prs505/sony_cache.py @@ -89,6 +89,10 @@ class XMLCache(object): raw, strip_encoding_pats=True, assume_utf8=True, verbose=DEBUG)[0], parser=parser) + if self.roots[source_id] is None: + raise Exception(('The SONY database at %s is corrupted. Try ' + ' disconnecting and reconnecting your reader.')%path) + # }}} recs = self.roots[0].xpath('//*[local-name()="records"]')