File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
exercises/13_error_handling
solutions/13_error_handling Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 5
5
// the player typed in the quantity, we get it as a string. They might have
6
6
// typed anything, not just numbers!
7
7
//
8
- // Right now, this function isn't handling the error case at all (and isn't
9
- // handling the success case properly either). What we want to do is: If we call
10
- // the `total_cost` function on a string that is not a number, that function
11
- // will return a `ParseIntError`. In that case, we want to immediately return
12
- // that error from our function and not try to multiply and add.
8
+ // Right now, this function isn't handling the error case at all. What we want
9
+ // to do is: If we call the `total_cost` function on a string that is not a
10
+ // number, that function will return a `ParseIntError`. In that case, we want to
11
+ // immediately return that error from our function and not try to multiply and
12
+ // add.
13
13
//
14
14
// There are at least two ways to implement this that are both correct. But one
15
15
// is a lot shorter!
Original file line number Diff line number Diff line change 5
5
// the player typed in the quantity, we get it as a string. They might have
6
6
// typed anything, not just numbers!
7
7
//
8
- // Right now, this function isn't handling the error case at all (and isn't
9
- // handling the success case properly either). What we want to do is: If we call
10
- // the `total_cost` function on a string that is not a number, that function
11
- // will return a `ParseIntError`. In that case, we want to immediately return
12
- // that error from our function and not try to multiply and add.
8
+ // Right now, this function isn't handling the error case at all. What we want
9
+ // to do is: If we call the `total_cost` function on a string that is not a
10
+ // number, that function will return a `ParseIntError`. In that case, we want to
11
+ // immediately return that error from our function and not try to multiply and
12
+ // add.
13
13
//
14
14
// There are at least two ways to implement this that are both correct. But one
15
15
// is a lot shorter!
You can’t perform that action at this time.
0 commit comments