From 8a87e7efd520ec3153bb639a146b975f7fe0102a Mon Sep 17 00:00:00 2001 From: Trinity Agent Date: Wed, 11 Mar 2026 18:47:10 +0000 Subject: [PATCH] fix(history): add error logging to silent catch {} handlers (#167) Replace empty catch {} handlers with proper error logging using std.log.debug for consistency. This prevents persistence failures from being silently swallowed. Changes: - History.add(): log save errors - ReplHistory.load(): log load errors - ReplHistory.saveBeforeExit(): log save errors Co-Authored-By: Claude Opus 4.6 --- src/tri/tri_history.zig | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/tri/tri_history.zig b/src/tri/tri_history.zig index 780bb991f2..18315c9eea 100644 --- a/src/tri/tri_history.zig +++ b/src/tri/tri_history.zig @@ -61,7 +61,9 @@ pub const History = struct { } // Save to file - self.save() catch {}; + self.save() catch |err| { + std.log.debug("history save: {s}", .{@errorName(err)}); + }; } /// Navigate to previous command @@ -252,7 +254,9 @@ pub const ReplHistory = struct { /// Load history from file pub fn load(self: *ReplHistory) !void { - self.history.load() catch {}; + self.history.load() catch |err| { + std.log.debug("history load: {s}", .{@errorName(err)}); + }; } /// Save current input and clear @@ -312,7 +316,9 @@ pub const ReplHistory = struct { /// Save history before exit pub fn saveBeforeExit(self: *ReplHistory) void { - self.history.save() catch {}; + self.history.save() catch |err| { + std.log.debug("history save: {s}", .{@errorName(err)}); + }; } };