diff options
author | mihaylov <mihaylov@epfl.ch> | 2006-03-01 17:11:47 +0000 |
---|---|---|
committer | mihaylov <mihaylov@epfl.ch> | 2006-03-01 17:11:47 +0000 |
commit | 3427c16568b067eba764c2279cf340789b5232ab (patch) | |
tree | f5fad09bcf28f0203d7a27f0c1691e4dac0aa363 /src/library | |
parent | ba2010fcadec98e8db28cdd85b78121c16b4673f (diff) | |
download | scala-3427c16568b067eba764c2279cf340789b5232ab.tar.gz scala-3427c16568b067eba764c2279cf340789b5232ab.tar.bz2 scala-3427c16568b067eba764c2279cf340789b5232ab.zip |
improved error message for missing key
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/Map.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/library/scala/collection/Map.scala b/src/library/scala/collection/Map.scala index 14546e9e71..8a20f10255 100644 --- a/src/library/scala/collection/Map.scala +++ b/src/library/scala/collection/Map.scala @@ -53,7 +53,7 @@ trait Map[A, +B] extends AnyRef with PartialFunction[A, B] with Iterable[Pair[A, * @return the value associated with the given key. */ def apply(key: A): B = get(key) match { - case None => default + case None => default(key) case Some(value) => value } @@ -174,7 +174,7 @@ trait Map[A, +B] extends AnyRef with PartialFunction[A, B] with Iterable[Pair[A, * The method implemented here yields an error, * but it might be overridden in subclasses. */ - def default: B = - error("key not found") + def default(key: A): B = + error("key not found: " + key) } |