better logging on FsCache init failure

This commit is contained in:
Muki Kiboigo
2026-04-02 13:32:02 -07:00
parent 84933296cb
commit 0da5482b90

View File

@@ -17,6 +17,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
const std = @import("std"); const std = @import("std");
const log = @import("../log.zig");
const builtin = @import("builtin"); const builtin = @import("builtin");
const net = std.net; const net = std.net;
const posix = std.posix; const posix = std.posix;
@@ -29,7 +30,9 @@ const libcurl = @import("../sys/libcurl.zig");
const http = @import("http.zig"); const http = @import("http.zig");
const RobotStore = @import("Robots.zig").RobotStore; const RobotStore = @import("Robots.zig").RobotStore;
const WebBotAuth = @import("WebBotAuth.zig"); const WebBotAuth = @import("WebBotAuth.zig");
const Cache = @import("cache/Cache.zig"); const Cache = @import("cache/Cache.zig");
const FsCache = @import("cache/FsCache.zig");
const App = @import("../App.zig"); const App = @import("../App.zig");
const Network = @This(); const Network = @This();
@@ -238,7 +241,18 @@ pub fn init(allocator: Allocator, app: *App, config: *const Config) !Network {
null; null;
const cache = if (config.cacheDir()) |cache_dir_path| const cache = if (config.cacheDir()) |cache_dir_path|
Cache{ .kind = .{ .fs = try .init(cache_dir_path) } } Cache{
.kind = .{
.fs = FsCache.init(cache_dir_path) catch |e| {
log.err(.cache, "failed to init", .{
.kind = "FsCache",
.path = cache_dir_path,
.err = e,
});
return e;
},
},
}
else else
null; null;