Rasters.jl
Rasters.jl copied to clipboard
Catch error in write to remove broken file
When the write command errors it still sometimes construct a broken file on disk. This change should make sure, that the write function would tidy up these broken files after faliure, because they are in the way for later analysis.
Do you think, that this is enough to capture all broken files? Should this also be tested for other backends?
Locally I get some spurious failures which have nothing to do with the changes but are coming from some download time out errors.
Codecov Report
Merging #483 (17c4cac) into main (2603bd1) will decrease coverage by
0.17%. The diff coverage is100.00%.
@@ Coverage Diff @@
## main #483 +/- ##
==========================================
- Coverage 81.15% 80.98% -0.17%
==========================================
Files 49 49
Lines 4113 4108 -5
==========================================
- Hits 3338 3327 -11
- Misses 775 781 +6
| Files Changed | Coverage Δ | |
|---|---|---|
| src/write.jl | 89.79% <100.00%> (+0.90%) |
:arrow_up: |
... and 7 files with indirect coverage changes
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
I think we need to first check the file didn't already exist!
One error could be that force=true was not used and the file existed.
Edit: thinking about it, this gets a little tricky if we use force=true and error before we change the original... maybe we should always write to a temp file, and only rename it when everything has worked? otherwise deleting it? Not sure...