summaryrefslogtreecommitdiff
path: root/src/main/scala/cc/spray/json/JsonFormat.scala
diff options
context:
space:
mode:
authorMathias <mathias@spray.cc>2011-07-19 11:00:03 +0200
committerMathias <mathias@spray.cc>2011-07-19 11:00:03 +0200
commitd10193d65b19ff977a30cd5de4aa7ba640e0f795 (patch)
treecd0dbca97db233a947e035babf7dc014941cb09a /src/main/scala/cc/spray/json/JsonFormat.scala
parente83c48eaf7d0bb0b1809ef0258d8980ac08bcf53 (diff)
downloadspray-json-d10193d65b19ff977a30cd5de4aa7ba640e0f795.tar.gz
spray-json-d10193d65b19ff977a30cd5de4aa7ba640e0f795.tar.bz2
spray-json-d10193d65b19ff977a30cd5de4aa7ba640e0f795.zip
Improve compile time error messages with @implicitNotFound annotations
Diffstat (limited to 'src/main/scala/cc/spray/json/JsonFormat.scala')
-rw-r--r--src/main/scala/cc/spray/json/JsonFormat.scala4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/scala/cc/spray/json/JsonFormat.scala b/src/main/scala/cc/spray/json/JsonFormat.scala
index 0fedd3f..c5bc53e 100644
--- a/src/main/scala/cc/spray/json/JsonFormat.scala
+++ b/src/main/scala/cc/spray/json/JsonFormat.scala
@@ -17,9 +17,12 @@
package cc.spray.json
+import annotation.implicitNotFound
+
/**
* Provides the JSON deserialization for type T.
*/
+@implicitNotFound(msg = "Cannot find JsonReader or JsonFormat type class for ${T}")
trait JsonReader[T] {
def read(json: JsValue): T
}
@@ -33,6 +36,7 @@ object JsonReader {
/**
* Provides the JSON serialization for type T.
*/
+@implicitNotFound(msg = "Cannot find JsonWriter or JsonFormat type class for ${T}")
trait JsonWriter[T] {
def write(obj: T): JsValue
}