std: add some better failure msgs to json
This commit is contained in:
@@ -827,7 +827,7 @@ impl<'self> serialize::Decoder for Decoder<'self> {
|
|||||||
debug!("read_owned_str");
|
debug!("read_owned_str");
|
||||||
match *self.pop() {
|
match *self.pop() {
|
||||||
String(ref s) => copy *s,
|
String(ref s) => copy *s,
|
||||||
_ => fail!(~"not a string")
|
ref json => fail!(fmt!("not a string: %?", *json))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -835,7 +835,7 @@ impl<'self> serialize::Decoder for Decoder<'self> {
|
|||||||
debug!("read_managed_str");
|
debug!("read_managed_str");
|
||||||
match *self.pop() {
|
match *self.pop() {
|
||||||
String(ref s) => s.to_managed(),
|
String(ref s) => s.to_managed(),
|
||||||
_ => fail!(~"not a string")
|
ref json => fail!(fmt!("not a string: %?", *json))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -872,7 +872,7 @@ impl<'self> serialize::Decoder for Decoder<'self> {
|
|||||||
let name = match *self.peek() {
|
let name = match *self.peek() {
|
||||||
String(ref s) => s,
|
String(ref s) => s,
|
||||||
List([String(ref s), .. _]) => s,
|
List([String(ref s), .. _]) => s,
|
||||||
json => fail!(fmt!("invalid variant: %?", json)),
|
ref json => fail!(fmt!("invalid variant: %?", *json)),
|
||||||
};
|
};
|
||||||
let idx = match vec::position(names, |n| str::eq_slice(*n, *name)) {
|
let idx = match vec::position(names, |n| str::eq_slice(*n, *name)) {
|
||||||
Some(idx) => idx,
|
Some(idx) => idx,
|
||||||
|
|||||||
Reference in New Issue
Block a user