Skip to content

Commit a1c894f

Browse files
author
Trinity Agent
committed
fix(utils): replace catch {} with error logging in tri_utils.zig (#182)
Replace silent error swallowing with debug logging for corpus and context index operations. Using std.log.debug since load failures on first run are expected (no existing files to load). Affected lines: - corpus.loadInto() at line 322 - ctx_mgr.loadIndex() at line 327 - mgr.saveIndex() at line 365 - corpus.save() at line 373 Closes #182
1 parent c16ed8f commit a1c894f

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/tri/tri_utils.zig

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,16 @@ pub const CLIState = struct {
319319
const corpus = try allocator.create(tvc.TVCCorpus);
320320
corpus.initInPlace();
321321
// Try loading existing corpus from disk (load into heap-allocated struct)
322-
corpus.loadInto(TVC_CORPUS_PATH) catch {};
322+
corpus.loadInto(TVC_CORPUS_PATH) catch |err| {
323+
std.log.debug("corpus load: {s}", .{@errorName(err)});
324+
};
323325

324326
// Codebase Context Manager (Cycle 92)
325327
const ctx_mgr = try allocator.create(tri_context.ContextManager);
326328
ctx_mgr.* = tri_context.ContextManager.init(allocator);
327-
ctx_mgr.loadIndex() catch {};
329+
ctx_mgr.loadIndex() catch |err| {
330+
std.log.debug("context index load: {s}", .{@errorName(err)});
331+
};
328332

329333
// Read API keys from environment
330334
const groq_key = std.process.getEnvVarOwned(allocator, "GROQ_API_KEY") catch null;
@@ -362,15 +366,19 @@ pub const CLIState = struct {
362366
// Save context index before exit (Cycle 92)
363367
if (self.context_mgr) |mgr| {
364368
if (mgr.is_dirty) {
365-
mgr.saveIndex() catch {};
369+
mgr.saveIndex() catch |err| {
370+
std.log.debug("context index save: {s}", .{@errorName(err)});
371+
};
366372
}
367373
mgr.deinit();
368374
self.allocator.destroy(mgr);
369375
self.context_mgr = null;
370376
}
371377
// Save TVC corpus to disk before exit
372378
if (self.tvc_corpus) |corpus| {
373-
corpus.save(TVC_CORPUS_PATH) catch {};
379+
corpus.save(TVC_CORPUS_PATH) catch |err| {
380+
std.log.debug("corpus save: {s}", .{@errorName(err)});
381+
};
374382
self.allocator.destroy(corpus);
375383
self.tvc_corpus = null;
376384
}

0 commit comments

Comments
 (0)