diff --git a/src/network/Network.zig b/src/network/Network.zig index 0cfc7a20..abb64fce 100644 --- a/src/network/Network.zig +++ b/src/network/Network.zig @@ -17,6 +17,7 @@ // along with this program. If not, see . const std = @import("std"); +const log = @import("../log.zig"); const builtin = @import("builtin"); const net = std.net; const posix = std.posix; @@ -29,7 +30,9 @@ const libcurl = @import("../sys/libcurl.zig"); const http = @import("http.zig"); const RobotStore = @import("Robots.zig").RobotStore; const WebBotAuth = @import("WebBotAuth.zig"); + const Cache = @import("cache/Cache.zig"); +const FsCache = @import("cache/FsCache.zig"); const App = @import("../App.zig"); const Network = @This(); @@ -238,7 +241,18 @@ pub fn init(allocator: Allocator, app: *App, config: *const Config) !Network { null; 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 null;