Skip to content

Conversation

@forketyfork
Copy link
Owner

Summary

  • Replace 21 instances of bare catch {} that silently swallowed errors with explicit error handling
  • Add scoped loggers to UI components and session modules for consistent warning output
  • Document the one intentional exception in shell.zig (forked child process context)

Test plan

  • zig build passes
  • zig build test passes
  • Verified only one documented catch {} remains (in shell.zig fork context)

Replace 21 instances of bare `catch {}` that silently swallowed errors
with explicit error handling that logs warnings. This follows the
project's CLAUDE.md guideline to "never swallow errors with bare
catch {}".

Changes by file:
- session/state.zig: log processOutput failures
- session/notify.zig: log socket chmod, fcntl, and queue push failures
- main.zig: log input/selection/clear screen failures
- UI components: log action queue failures with scoped loggers

One intentional exception remains in shell.zig for chdir in forked
child process context, documented with a comment explaining why
logging is impractical there.
Correct the "Type Inference with Builtin Functions" section:
- The bug occurs when GRID_COLS is comptime_int (not usize)
- Fix example to show comptime_int causing the issue
- Correct wrap value (wraps to 1, not 0)
- Add debug vs release behavior (panic vs silent wrap)
- Simplify solution to emphasize `: usize` annotation

Also update restart_buttons.zig to follow the recommended pattern:
- Add `: usize` annotations to @min results
- Remove redundant @as(usize, host.grid_cols) casts
Add comments explaining why WaitContext may leak at shutdown and why
this is acceptable: OS reclaims memory anyway, proper xev cancellation
would require threading the loop through to deinit, and there's no race
condition since xev is single-threaded.
@forketyfork forketyfork merged commit b685cc6 into main Jan 19, 2026
4 checks passed
@forketyfork forketyfork deleted the sins branch January 19, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants