diff options
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 { |