From d10193d65b19ff977a30cd5de4aa7ba640e0f795 Mon Sep 17 00:00:00 2001 From: Mathias Date: Tue, 19 Jul 2011 11:00:03 +0200 Subject: Improve compile time error messages with @implicitNotFound annotations --- src/main/scala/cc/spray/json/JsonFormat.scala | 4 ++++ 1 file changed, 4 insertions(+) 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 } -- cgit v1.2.3