dubeejw commented on a change in pull request #2218: Port Controller from Spray 
to Akka
URL: 
https://github.com/apache/incubator-openwhisk/pull/2218#discussion_r130366832
 
 

 ##########
 File path: core/controller/src/main/scala/whisk/core/controller/Actions.scala
 ##########
 @@ -619,18 +626,33 @@ trait WhiskActionsApi
     /** Max atomic action count allowed for sequences */
     private lazy val actionSequenceLimit = 
whiskConfig.actionSequenceLimit.toInt
 
-    /** Custom deserializer for timeout query parameter. */
-    private implicit val stringToTimeoutDeserializer = new 
FromStringDeserializer[FiniteDuration] {
-        val max = WhiskActionsApi.maxWaitForBlockingActivation.toMillis
-        def apply(msecs: String): Either[DeserializationError, FiniteDuration] 
= {
-            Try { msecs.toInt } match {
-                case Success(i) if i > 0 && i <= max => Right(i.milliseconds)
-                case _ => Left {
-                    
MalformedContent(Messages.invalidTimeout(WhiskActionsApi.maxWaitForBlockingActivation))
-                }
+    implicit val stringToFiniteDuration: Unmarshaller[String, FiniteDuration] 
= {
+        Unmarshaller.strict[String, FiniteDuration] { value =>
+            val max = WhiskActionsApi.maxWaitForBlockingActivation.toMillis
+
+            Try {
+                value.toInt
+            } match {
+                case Success(i) if i > 0 && i <= max => i.milliseconds
+                case _ => throw new 
IllegalArgumentException(Messages.invalidTimeout(WhiskActionsApi.maxWaitForBlockingActivation))
             }
         }
     }
+
+    implicit val entityToJsObject: Unmarshaller[HttpEntity, JsObject] = {
 
 Review comment:
   I had to add a custom unmarshaller since the functionality in the default 
one differed from Spray. The issue was that when an empty payload was received, 
the default unmarshaller would through an error since an empty payload isn't 
valid JSON.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to