Skip to content

Commit 88e20d3

Browse files
committed
Improve error messages on config parse errors
1 parent 512d5ae commit 88e20d3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

build.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,7 @@ mod binary {
394394
if num % 0x1000 == 0 {
395395
Ok(AlignedAddress(num))
396396
} else {
397-
Err(serde::de::Error::invalid_value(
398-
serde::de::Unexpected::Unsigned(num),
399-
&self,
400-
))
397+
Err(serde::de::Error::custom(format!("address {:#x} is not page aligned", num)))
401398
}
402399
}
403400

@@ -411,7 +408,7 @@ mod binary {
411408
u64::from_str_radix(&value, 10)
412409
}
413410
.map_err(|_err| {
414-
serde::de::Error::invalid_value(serde::de::Unexpected::Str(value), &self)
411+
serde::de::Error::custom(format!("string \"{}\" is not a valid memory address", value))
415412
})?;
416413

417414
self.visit_u64(num)

0 commit comments

Comments
 (0)