Name the path an archive failed on

This commit is contained in:
2026-09-28 17:00:41 +02:00
parent 6e31e0a833
commit a4b63e436e
3 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -47,12 +47,12 @@ def archive(root, path, note, paths):
raw = handle.read()
make_private(folder)
except OSError as failure:
return Failure(f"could not archive the transcript {path}: {failure.strerror}")
return Failure(f"could not archive the transcript: {failure.filename}: {failure.strerror}")
copy = folder / f"{hashlib.sha256(raw).hexdigest()}.jsonl"
# The copy lands last, so a copy on disk always has its verdict beside it.
if not copy.exists():
for dest, data in ((copy.with_suffix(".verdict.md"), f"{note}\n".encode()), (copy, raw)):
if failure := replace_file(dest, data):
return Failure(f"could not archive the transcript {path}: {failure.strerror}")
return Failure(f"could not archive the transcript: {failure.filename}: {failure.strerror}")
print(f"transcript: {copy}", file=sys.stderr)
return None