This commit is contained in:
parent
7f02b7f304
commit
509e2c52b0
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue