Skip to content

Commit 02e1152

Browse files
Trinity Agentclaude
andcommitted
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 <noreply@anthropic.com>
1 parent 907b37b commit 02e1152

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/tri/tri_research.zig

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,14 @@ fn runPerplexityQuery(allocator: std.mem.Allocator, args: []const []const u8) !v
260260
fn cacheAnswer(allocator: std.mem.Allocator, path: []const u8, answer: []const u8) !void {
261261
_ = allocator;
262262
if (path.len == 0) return;
263-
std.fs.cwd().makePath(CACHE_DIR) catch {};
263+
std.fs.cwd().makePath(CACHE_DIR) catch |err| {
264+
std.log.warn("failed to create cache dir: {s}", .{@errorName(err)});
265+
};
264266
const file = std.fs.cwd().createFile(path, .{}) catch return;
265267
defer file.close();
266-
file.writeAll(answer) catch {};
268+
file.writeAll(answer) catch |err| {
269+
std.log.warn("failed to write cache: {s}", .{@errorName(err)});
270+
};
267271
}
268272

269273
/// Offline pattern matching for common Zig errors

0 commit comments

Comments
 (0)