Skip to content

Commit 2b20c8a

Browse files
authored
fix(errorsn): Try harder to confine the user. (#388)
1 parent 1b4590b commit 2b20c8a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

exercises/error_handling/errorsn.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
// This is a bigger error exercise than the previous ones!
33
// You can do it! :)
44
//
5-
// Edit the `read_and_validate` function so that it compiles and
6-
// passes the tests... so many things could go wrong!
5+
// Edit the `read_and_validate` function ONLY. Don't create any Errors
6+
// that do not already exist.
7+
//
8+
// So many things could go wrong!
79
//
810
// - Reading from stdin could produce an io::Error
911
// - Parsing the input could produce a num::ParseIntError
@@ -30,6 +32,10 @@ fn read_and_validate(b: &mut dyn io::BufRead) -> Result<PositiveNonzeroInteger,
3032
answer
3133
}
3234

35+
//
36+
// Nothing below this needs to be modified
37+
//
38+
3339
// This is a test helper function that turns a &str into a BufReader.
3440
fn test_with_str(s: &str) -> Result<PositiveNonzeroInteger, Box<dyn error::Error>> {
3541
let mut b = io::BufReader::new(s.as_bytes());

0 commit comments

Comments
 (0)