If old shelf migration fails, keep going
authorJack Miller <jack@codezen.org>
Sun, 29 Nov 2015 01:23:40 +0000 (19:23 -0600)
committerJack Miller <jack@codezen.org>
Sun, 29 Nov 2015 01:23:40 +0000 (19:23 -0600)
We'll never be able to do anything constructive with crap data, so log
it and then continue on with an empty feeds database.

canto_next/storage.py

index 4d41490..c6de8a4 100644 (file)
@@ -55,8 +55,18 @@ class CantoShelf():
                         self.cache[key] = s[key]
                 except Exception as e:
                     log.error("Failed to migrate old shelf: %s", e)
-                    raise
-                log.info("Migrated old shelf")
+                    try:
+                        f = open(self.filename)
+                        data = f.read()
+                        f.close()
+                        log.error("BAD DATA: [%s]" % data)
+                    except Exception as e:
+                        log.error("Couldn't even read data? %s" % e)
+                        pass
+                    log.error("Carrying on with empty shelf")
+                    self.cache = {}
+                else:
+                    log.info("Migrated old shelf")
             finally:
                 fp.close()