Commit c206b6e
transfer: name the file in the existence errors (#200)
checkFileExistence reported both outcomes without saying which file it meant, so what
reached the user was "Failed to download file: Failed to check file existence: File
already exists" with no path at all.
For the caller's own destination that is merely terse. For a fragment temp file it
misleads: fragments are downloaded to <root>.temp in the process working directory, and
if one survives an attempt - the copy into the output failed, os.Remove failed, the
process was killed mid-iteration - every later attempt reports "File already exists"
for a file the caller never created. They inspect the output file they asked for, find
nothing wrong, delete it, retry, and get the same error, with nothing indicating what
is actually blocking them.
Include the path in both. ErrFileAlreadyExists is wrapped rather than replaced so the
errors.Is checks that depend on it keep matching - download_dir relies on it in three
places, and the fragment loops in #199 will too.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent dfec67f commit c206b6e
2 files changed
Lines changed: 48 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
291 | 296 | | |
292 | | - | |
| 297 | + | |
293 | 298 | | |
294 | 299 | | |
295 | | - | |
| 300 | + | |
296 | 301 | | |
297 | 302 | | |
298 | 303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
0 commit comments