From 85293235bfc170d7781049b0eda6888c349f78ca Mon Sep 17 00:00:00 2001 From: Trinity Agent Date: Wed, 11 Mar 2026 19:07:26 +0000 Subject: [PATCH] fix(research): add error logging to catch {} handlers (#177) Replace silent error swallowing with proper logging in cacheAnswer(): - makePath() now logs warning on cache dir creation failure - writeAll() now logs warning on cache write failure Co-Authored-By: Claude Opus 4.6 --- src/tri/tri_research.zig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tri/tri_research.zig b/src/tri/tri_research.zig index 9706256e08..18d2bd62fc 100644 --- a/src/tri/tri_research.zig +++ b/src/tri/tri_research.zig @@ -260,10 +260,14 @@ fn runPerplexityQuery(allocator: std.mem.Allocator, args: []const []const u8) !v fn cacheAnswer(allocator: std.mem.Allocator, path: []const u8, answer: []const u8) !void { _ = allocator; if (path.len == 0) return; - std.fs.cwd().makePath(CACHE_DIR) catch {}; + std.fs.cwd().makePath(CACHE_DIR) catch |err| { + std.log.warn("failed to create cache dir: {s}", .{@errorName(err)}); + }; const file = std.fs.cwd().createFile(path, .{}) catch return; defer file.close(); - file.writeAll(answer) catch {}; + file.writeAll(answer) catch |err| { + std.log.warn("failed to write cache: {s}", .{@errorName(err)}); + }; } /// Offline pattern matching for common Zig errors