This commit is contained in:
Samuel Webb 2024-07-11 19:57:48 -04:00
parent e8f09190d6
commit 5b51d6f393
46 changed files with 83 additions and 65 deletions

View file

@ -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 {