openwhisk-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [openwhisk] chetanmeh commented on a change in pull request #4660: Include response size in Activation
Date Tue, 08 Oct 2019 11:36:04 GMT
chetanmeh commented on a change in pull request #4660: Include response size in Activation
URL: https://github.com/apache/openwhisk/pull/4660#discussion_r332464060
 
 

 ##########
 File path: common/scala/src/main/scala/org/apache/openwhisk/core/entity/ActivationResult.scala
 ##########
 @@ -86,19 +88,25 @@ protected[core] object ActivationResponse extends DefaultJsonProtocol
{
     }
   }
 
-  private def error(code: Int, errorValue: JsValue) = {
+  private def error(code: Int, errorValue: JsValue, size: Option[Int]) = {
     require(code == ApplicationError || code == DeveloperError || code == WhiskError)
-    ActivationResponse(code, Some(JsObject(ERROR_FIELD -> errorValue)))
+    ActivationResponse(code, Some(JsObject(ERROR_FIELD -> errorValue)), size)
   }
 
-  protected[core] def success(result: Option[JsValue] = None) = ActivationResponse(Success,
result)
-
-  protected[core] def applicationError(errorValue: JsValue) = error(ApplicationError, errorValue)
-  protected[core] def applicationError(errorMsg: String) = error(ApplicationError, JsString(errorMsg))
-  protected[core] def developerError(errorValue: JsValue) = error(DeveloperError, errorValue)
-  protected[core] def developerError(errorMsg: String) = error(DeveloperError, JsString(errorMsg))
-  protected[core] def whiskError(errorValue: JsValue) = error(WhiskError, errorValue)
-  protected[core] def whiskError(errorMsg: String) = error(WhiskError, JsString(errorMsg))
+  protected[core] def success(result: Option[JsValue] = None, size: Option[Int] = None) =
 
 Review comment:
   Size is only applicable for case where error is based on some response (similar to via
result is an Option). In some case we just construct a failed response due to connection error
etc and there size is not applicable

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message