blob: a1b9aef97dc4396e8e89bf1394592f260cce3743 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
pub fn main() void {
foo() catch |err| {
assert(err == error.Foo);
assert(err != error.Bar);
assert(err != error.Baz);
};
bar() catch |err| {
assert(err != error.Foo);
assert(err == error.Bar);
assert(err != error.Baz);
};
}
fn assert(ok: bool) void {
if (!ok) unreachable;
}
fn foo() anyerror!void {
return error.Foo;
}
fn bar() anyerror!void {
return error.Bar;
}
// run
//
|