From 0e447c7956410a993614f9337d6219e017722443 Mon Sep 17 00:00:00 2001 From: Martin Ashby Date: Fri, 9 Dec 2022 22:07:01 +0000 Subject: 001-024 complete --- exercises/024_errors4.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'exercises/024_errors4.zig') 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 { -- cgit v1.2.3-ZIG