Skip to content

fix(query): replace 5 catch unreachable with try in tri_query_commands.zig #163

@gHashTag

Description

@gHashTag

Task

In src/tri/tri_query_commands.zig there are 5 instances of catch unreachable on allocator calls:

  • Line 1043: result.trits = self.allocator.alloc(i8, self.trits.len) catch unreachable;
  • Line 1068: inversed.trits = self.allocator.alloc(i8, key.trits.len) catch unreachable;
  • Line 1087: result.trits = self.allocator.alloc(i8, self.trits.len) catch unreachable;
  • Line 1122: result.trits = self.allocator.alloc(i8, self.trits.len) catch unreachable;
  • Line 1502: entities[i] = BipolarBigInt.semanticRandom(std.heap.page_allocator, dim, seed, category_id) catch unreachable;

Allocation can fail. Use try instead.

Fix

Replace each catch unreachable with try. Ensure enclosing functions return error unions.

File

  • src/tri/tri_query_commands.zig — lines 1043, 1068, 1087, 1122, 1502

Acceptance

  • zig build compiles without errors
  • zig fmt passes
  • No catch unreachable on allocator calls in this file

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