Why does `error.Foo catch {};` compiles, error.Foo is error, not error union

Viewed 99

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.

0 Answers
Related