summaryrefslogtreecommitdiff
path: root/src/main/scala/cc/spray/json/CollectionFormats.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/cc/spray/json/CollectionFormats.scala')
-rw-r--r--src/main/scala/cc/spray/json/CollectionFormats.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/scala/cc/spray/json/CollectionFormats.scala b/src/main/scala/cc/spray/json/CollectionFormats.scala
index bcfa198..5fdee83 100644
--- a/src/main/scala/cc/spray/json/CollectionFormats.scala
+++ b/src/main/scala/cc/spray/json/CollectionFormats.scala
@@ -26,7 +26,7 @@ trait CollectionFormats {
def write(list: List[T]) = JsArray(list.map(_.toJson))
def read(value: JsValue) = value match {
case JsArray(elements) => elements.map(_.convertTo[T])
- case _ => throw new DeserializationException("List expected")
+ case x => throw new DeserializationException("Expected List as JsArray, but got " + x)
}
}
@@ -37,7 +37,7 @@ trait CollectionFormats {
def write(array: Array[T]) = JsArray(array.map(_.toJson).toList)
def read(value: JsValue) = value match {
case JsArray(elements) => elements.map(_.convertTo[T]).toArray[T]
- case _ => throw new DeserializationException("Array expected")
+ case x => throw new DeserializationException("Expected Array as JsArray, but got " + x)
}
}
@@ -56,7 +56,7 @@ trait CollectionFormats {
}
def read(value: JsValue) = value match {
case JsObject(fields) => fields.map(field => (JsString(field.name).convertTo[K], field.value.convertTo[V])).toMap
- case _ => throw new DeserializationException("Map expected")
+ case x => throw new DeserializationException("Expected Map as JsObject, but got " + x)
}
}
@@ -85,7 +85,7 @@ trait CollectionFormats {
def write(iterable: I) = JsArray(iterable.map(_.toJson).toList)
def read(value: JsValue) = value match {
case JsArray(elements) => f(elements.map(_.convertTo[T]))
- case _ => throw new DeserializationException("Collection expected")
+ case x => throw new DeserializationException("Expected Collection as JsArray, but got " + x)
}
}