Skip to content

Commit

Permalink
JSONStore: log and and fail gracefully in read_json
Browse files Browse the repository at this point in the history
  • Loading branch information
rkingsbury committed Oct 8, 2024
1 parent 216f1a6 commit a823360
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/maggma/stores/mongolike.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,12 @@ def connect(self, force_reset: bool = False):
f.write(bytesdata.decode("utf-8"))

for path in self.paths:
objects = self.read_json_file(path)
self.logger.debug(f"Reading {path}")
try:
objects = self.read_json_file(path)
except Exception as e:
self.logger.error(f"Error reading {path}: {e}. Skipping.")

try:
self.update(objects)
except KeyError:
Expand Down

0 comments on commit a823360

Please sign in to comment.