diff options
author | Martin Ashby <martin@ashbysoft.com> | 2022-12-09 22:07:01 +0000 |
---|---|---|
committer | Martin Ashby <martin@ashbysoft.com> | 2022-12-09 22:07:01 +0000 |
commit | 0e447c7956410a993614f9337d6219e017722443 (patch) | |
tree | c12780891cbbd14b52695df1fe336cc8981de6d9 /exercises/024_errors4.zig | |
parent | bb5b8f115a57fc8c85ac7344fe4dc0b796e32487 (diff) | |
download | ziglings-0e447c7956410a993614f9337d6219e017722443.tar.gz ziglings-0e447c7956410a993614f9337d6219e017722443.tar.bz2 ziglings-0e447c7956410a993614f9337d6219e017722443.tar.xz ziglings-0e447c7956410a993614f9337d6219e017722443.zip |
001-024 complete
Diffstat (limited to 'exercises/024_errors4.zig')
-rw-r--r-- | exercises/024_errors4.zig | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/exercises/024_errors4.zig b/exercises/024_errors4.zig index c2f4f6f..96b6538 100644 --- a/exercises/024_errors4.zig +++ b/exercises/024_errors4.zig @@ -59,7 +59,12 @@ fn fixTooSmall(n: u32) MyNumberError!u32 { // If we get a TooSmall error, we should return 10. // If we get any other error, we should return that error. // Otherwise, we return the u32 number. - return detectProblems(n) ???; + return detectProblems(n) catch |err| { + if (err == MyNumberError.TooSmall) { + return 10; + } + return err; + }; } fn detectProblems(n: u32) MyNumberError!u32 { |