about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-03-26 23:15:14 -0700
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2013-03-27 07:04:17 -0700
commitc317d3f6fa9475e65b6276743c09444441059ca7 (patch)
treead263ba2492d57fe9d6c587d5a7992680dc8d82b /src/libstd
parent83e831bc229c2346e2322aaad1fdaa219325a4b3 (diff)
downloadrust-c317d3f6fa9475e65b6276743c09444441059ca7.tar.gz
rust-c317d3f6fa9475e65b6276743c09444441059ca7.zip
std: add some better failure msgs to json
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/json.rs6
1 files 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 @@ impl<'self> serialize::Decoder for Decoder<'self> {
         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 @@ impl<'self> serialize::Decoder for Decoder<'self> {
         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 @@ impl<'self> serialize::Decoder for Decoder<'self> {
         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,