From 54e022d8172fee86bebc836a1012ae865d0c7e40 Mon Sep 17 00:00:00 2001 From: Lukas Lalinsky Date: Sat, 7 Dec 2024 08:35:51 +0100 Subject: [PATCH] Do not treat FileNotFound as error when cleaning up segment file --- src/FileSegment.zig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/FileSegment.zig b/src/FileSegment.zig index b572f8c..dec35d3 100644 --- a/src/FileSegment.zig +++ b/src/FileSegment.zig @@ -107,7 +107,9 @@ pub fn delete(self: *Self) void { log.info("deleting segment file {s}", .{file_name}); self.dir.deleteFile(file_name) catch |err| { - log.err("failed to clean up segment file {s}: {}", .{ file_name, err }); + if (err != error.FileNotFound) { + log.err("failed to clean up segment file {s}: {}", .{ file_name, err }); + } }; } @@ -126,7 +128,9 @@ pub fn build(self: *Self, source: anytype) !void { try filefmt.writeSegmentFile(self.dir, source); errdefer self.dir.deleteFile(file_name) catch |err| { - log.err("failed to clean up segment file {s}: {}", .{ file_name, err }); + if (err != error.FileNotFound) { + log.err("failed to clean up segment file {s}: {}", .{ file_name, err }); + } }; try filefmt.readSegmentFile(self.dir, source.segment.info, self);