mirror of
https://git.aramjonghu.dev/AramJonghu/rustlings.git
synced 2026-09-08 02:33:31 +02:00
feat(errors): completed errors
This commit is contained in:
@@ -34,7 +34,7 @@ impl PositiveNonzeroInteger {
|
||||
fn parse(s: &str) -> Result<Self, ParsePosNonzeroError> {
|
||||
// TODO: change this to return an appropriate error instead of panicking
|
||||
// when `parse()` returns an error.
|
||||
let x: i64 = s.parse().unwrap();
|
||||
let x: i64 = s.parse().map_err(ParsePosNonzeroError::ParseInt)?;
|
||||
Self::new(x).map_err(ParsePosNonzeroError::Creation)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user