Add more info to some error messages
authorTim Berners-Lee <timbl+hg@w3.org>
Fri, 01 Jun 2012 15:19:00 -0400
changeset 222 3e192786210d
parent 221 19c0f6ea8ad0
child 223 1a8afef3722c
Add more info to some error messages
src/main/scala/ReadWriteWeb.scala
--- a/src/main/scala/ReadWriteWeb.scala	Wed May 30 19:03:41 2012 +0200
+++ b/src/main/scala/ReadWriteWeb.scala	Fri Jun 01 15:19:00 2012 -0400
@@ -126,7 +126,7 @@
                 _ <- r.save(bodyModel) failMap { t => InternalServerError ~> ResponseString(t.getStackTraceString) }
               } yield Created
             case PUT(_) =>
-              BadRequest ~> ResponseString("Content-Type MUST be one of: " + Lang.supportedAsString)
+              BadRequest ~> ResponseString("Content-Type for PUT be one of: " + Lang.supportedAsString)
             case POST(_) & RequestContentType(ct) if representation == DirectoryRepr =>
               val createType = Representation.fromAcceptedContentTypes(List(ct))
               r.create(createType) failMap { t => NotFound ~> ResponseString(t.getStackTraceString)} flatMap { rNew =>
@@ -198,8 +198,8 @@
                 }
               }
             }
-            case POST(_) =>
-              BadRequest ~> ResponseString("Content-Type MUST be one of: " + Post.supportedAsString)
+            case POST(_) & RequestContentType(ct) =>    // @@@ not exhaustive
+              BadRequest ~> ResponseString("Content-Type '" + ct + "' for POST must be one of: " + Post.supportedAsString)
             case DELETE(_) => {
               for { _ <- r.delete failMap { t => NotFound ~> ResponseString("Error found"+t.toString)}
               } yield NoContent