diff options
Diffstat (limited to 'exercises/024_errors4.zig')
-rw-r--r-- | exercises/024_errors4.zig | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/exercises/024_errors4.zig b/exercises/024_errors4.zig index 02ec0f2..dc5c7d6 100644 --- a/exercises/024_errors4.zig +++ b/exercises/024_errors4.zig @@ -59,7 +59,13 @@ 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 { |