From c317d3f6fa9475e65b6276743c09444441059ca7 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Tue, 26 Mar 2013 23:15:14 -0700 Subject: [PATCH] std: add some better failure msgs to json --- src/libstd/json.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libstd/json.rs b/src/libstd/json.rs index 968c6d9e58b..c48b210dca2 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -827,7 +827,7 @@ fn read_owned_str(&self) -> ~str { debug!("read_owned_str"); match *self.pop() { String(ref s) => copy *s, - _ => fail!(~"not a string") + ref json => fail!(fmt!("not a string: %?", *json)) } } @@ -835,7 +835,7 @@ fn read_managed_str(&self) -> @str { debug!("read_managed_str"); match *self.pop() { String(ref s) => s.to_managed(), - _ => fail!(~"not a string") + ref json => fail!(fmt!("not a string: %?", *json)) } } @@ -872,7 +872,7 @@ fn read_enum_variant(&self, names: &[&str], f: &fn(uint) -> T) -> T { let name = match *self.peek() { 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)) { Some(idx) => idx,