Add a string argument to Error::syntax()

This commit is contained in:
Erick Tryzelaar
2015-08-07 08:08:56 -07:00
parent 2aeb51ad51
commit 7fb2bd50bf
13 changed files with 51 additions and 45 deletions
+2 -2
View File
@@ -275,7 +275,7 @@ to generate an error for a few common error conditions. Here's how it could be u
fn visit_string<E>(&mut self, _: String) -> Result<i32, E>
where E: Error,
{
Err(serde::de::Error::syntax())
Err(serde::de::Error::syntax("expect a string"))
}
...
@@ -366,7 +366,7 @@ impl serde::Deserialize for PointField {
match value {
"x" => Ok(Field::X),
"y" => Ok(Field::Y),
_ => Err(serde::de::Error::syntax()),
_ => Err(serde::de::Error::syntax("expected x or y")),
}
}
}