Browse Source

Handle a bad batch

Daoud Clarke 2 years ago
parent
commit
91269d5100
1 changed files with 5 additions and 1 deletions
  1. 5 1
      mwmbl/indexer/batch_cache.py

+ 5 - 1
mwmbl/indexer/batch_cache.py

@@ -39,7 +39,11 @@ class BatchCache:
             except FileNotFoundError:
             except FileNotFoundError:
                 logger.exception(f"Missing batch file: {path}")
                 logger.exception(f"Missing batch file: {path}")
                 continue
                 continue
-            batch = HashedBatch.parse_raw(data)
+            try:
+                batch = HashedBatch.parse_raw(data)
+            except ValidationError:
+                logger.exception(f"Unable to parse batch, skipping: '{data}'")
+                continue
             batches[url] = batch
             batches[url] = batch
         return batches
         return batches