about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-07-13 18:43:47 -0700
committerNiko Matsakis <niko@alum.mit.edu>2012-07-14 17:37:19 -0700
commit1fbb9d035ddd0c9ae56a91167fda2f100c3987ad (patch)
tree15c47f32d2e6346505dbf6f59bd1944039969c39 /src/libstd
parent6822ec3eb4cb39a3a075b8373fcc974424ef63e8 (diff)
downloadrust-1fbb9d035ddd0c9ae56a91167fda2f100c3987ad.tar.gz
rust-1fbb9d035ddd0c9ae56a91167fda2f100c3987ad.zip
improve failure message when key is not present
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/map.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstd/map.rs b/src/libstd/map.rs
index bce843224d1..90ca5e23372 100644
--- a/src/libstd/map.rs
+++ b/src/libstd/map.rs
@@ -237,7 +237,10 @@ mod chained {
         }
 
         fn get(k: K) -> V {
-            self.find(k).expect(~"Key not found in table")
+            alt self.find(k) {
+              some(v) => {v}
+              none => {fail #fmt["Key not found in table: %?", k]}
+            }
         }
 
         fn [](k: K) -> V {