Skip to content

Commit 171bbeb

Browse files
committed
catch exception on import of old index.json into ArchiveResult
1 parent 0aea5ed commit 171bbeb

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

archivebox/core/migrations/0007_archiveresult.py

+19-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,25 @@ def forwards_func(apps, schema_editor):
3636

3737
for extractor in history:
3838
for result in history[extractor]:
39-
ArchiveResult.objects.create(extractor=extractor, snapshot=snapshot, cmd=result["cmd"], cmd_version=result["cmd_version"] or 'unknown',
40-
start_ts=result["start_ts"], end_ts=result["end_ts"], status=result["status"], pwd=result["pwd"], output=result["output"] or 'null')
39+
try:
40+
ArchiveResult.objects.create(
41+
extractor=extractor,
42+
snapshot=snapshot,
43+
pwd=result["pwd"],
44+
cmd=result.get("cmd") or [],
45+
cmd_version=result.get("cmd_version") or 'unknown',
46+
start_ts=result["start_ts"],
47+
end_ts=result["end_ts"],
48+
status=result["status"],
49+
output=result.get("output") or 'null',
50+
)
51+
except Exception as e:
52+
print(
53+
' ! Skipping import due to missing/invalid index.json:',
54+
out_dir,
55+
e,
56+
'(open an issue with this index.json for help)',
57+
)
4158

4259

4360
def verify_json_index_integrity(snapshot):

0 commit comments

Comments
 (0)