debug messages for bad position data
This commit is contained in:
parent
41a08d7a61
commit
ed6552f39c
|
@ -10,13 +10,13 @@ impl Position {
|
||||||
pub(crate) fn from(string: String) -> Result<Position, &'static dyn Error> {
|
pub(crate) fn from(string: String) -> Result<Position, &'static dyn Error> {
|
||||||
// e.g. "2,5"
|
// e.g. "2,5"
|
||||||
let xy: Vec<&str> = string.split(',').collect();
|
let xy: Vec<&str> = string.split(',').collect();
|
||||||
let x = xy[0].parse().unwrap();
|
let x = xy[0].parse().expect("Bad x coordinate supplied for Position");
|
||||||
|
|
||||||
if xy.len() < 2 {
|
if xy.len() < 2 {
|
||||||
panic!("Bad position : {}", string);
|
panic!("Bad position : {}", string);
|
||||||
}
|
}
|
||||||
|
|
||||||
let y = xy[1].parse().unwrap();
|
let y = xy[1].parse().expect("Bad y coordinate supplied for Position");
|
||||||
|
|
||||||
Ok(Position { x, y })
|
Ok(Position { x, y })
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue