3

This code compiles:

error.Foo catch {};

But not:

error.Foo catch |bar| {
    std.debug.print("{s}", .{bar});
};

Why is that? Does catch without capturing payload works with error too? I thought catch only works with error union.

Helin Wang
  • 4,002
  • 1
  • 30
  • 34
  • 2
    That sounds like it might be a bug or oversight in zig - the first catch statement does not actually do anything and the code block never runs and there is no mention of that in the documentation. – pfg Dec 11 '21 at 00:14

0 Answers0