This commit is contained in:
Adam Millerchip 2021-12-25 23:56:45 +09:00
parent 7f02b7f304
commit 509e2c52b0
1 changed files with 7 additions and 1 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 {