Update the location of json errors coming from "Deserialize"

This commit is contained in:
Erick Tryzelaar
2015-03-30 19:50:41 -07:00
parent 3167da72d8
commit bfe7a04c4d
2 changed files with 14 additions and 8 deletions
+7 -1
View File
@@ -97,7 +97,7 @@ impl<Iter> Deserializer<Iter>
return Err(self.error(ErrorCode::EOFWhileParsingValue));
}
match self.ch_or_null() {
let value = match self.ch_or_null() {
b'n' => {
try!(self.parse_ident(b"ull"));
visitor.visit_unit()
@@ -127,6 +127,12 @@ impl<Iter> Deserializer<Iter>
_ => {
Err(self.error(ErrorCode::ExpectedSomeValue))
}
};
match value {
Ok(value) => Ok(value),
Err(Error::SyntaxError(code, _, _)) => Err(self.error(code)),
Err(err) => Err(err),
}
}