You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A workaround is to place the body code for the second prong into the body of the first prong, however this results in unnecessary code duplication. For example, take the following modified original snippet:
conststd=@import("std");
fndosomething() error{
FirstError,
SecondError,
}!void {
return;
}
pubfnmain() !void {
vara: u32=0;
dosomething() catch|err|switch (err) {
error.FirstError=> {
std.log.err("something somewhere went terribly wrong", .{});
//continue :errswitch error.SecondError;std.log.info("some important information regarding errors", .{});
},
error.SecondError=> {
std.log.info("some important information regarding errors", .{});
},
};
}
Zig Version
0.14.0-dev.1911+3bf89f55c
Steps to Reproduce and Observed Behavior
The following snippet fails to compile with
[1] 372270 trace trap (core dumped) zig build-exe minrepro.zig
This snippet, which contains effectively the same behaviour, compiles as expected.
Expected Behavior
The original snippet to compile, or at the very least contain a meaningful error message.
The text was updated successfully, but these errors were encountered: