Skip to content

fix(monitor): replace catch unreachable with try in eternal_monitor.zig init #151

Description

@gHashTag

Task

In src/tri/eternal_monitor.zig lines 135-136, ArrayList initialization uses catch unreachable:

monitor.components = std.ArrayList(SystemComponent).initCapacity(allocator, 16) catch unreachable;
monitor.alerts = std.ArrayList(Alert).initCapacity(allocator, 64) catch unreachable;

Allocation can fail. Use try instead of catch unreachable.

Fix

monitor.components = try std.ArrayList(SystemComponent).initCapacity(allocator, 16);
monitor.alerts = try std.ArrayList(Alert).initCapacity(allocator, 64);

The init function return type should include the error union if not already.

File

  • src/tri/eternal_monitor.zig — lines 135-136

Acceptance

  • zig build compiles without errors
  • zig fmt passes
  • No catch unreachable on ArrayList init

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:spawnAuto-spawn agent container

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions