|
|
|
|
|
by chrisco255
498 days ago
|
|
They're really just enum variants. You can easily capture the error and conditionally handle it: fn failFn() error{Oops}!i32 {
try failingFunction();
return 12;
} test "try" {
const v = failFn() catch |err| {
try expect(err == error.Oops);
return;
};
try expect(v == 12); // is never reached
} |
|
Sure. But the compiler won't help you check that your function only throws the errors that you think it does, or that your try block is handling all the errors that can be thrown inside it.