You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/03/21 12:47:44 UTC
[GitHub] rabbah commented on a change in pull request #3473: Support string based status code from actions.
rabbah commented on a change in pull request #3473: Support string based status code from actions.
URL: https://github.com/apache/incubator-openwhisk/pull/3473#discussion_r176068333
##########
File path: core/controller/src/main/scala/whisk/core/controller/WebActions.scala
##########
@@ -236,7 +236,15 @@ protected[core] object WhiskWebActionsApi extends Directives {
// the following throws an exception if the code is
// not a whole number or a valid code
StatusCode.int2StatusCode(c.toIntExact)
-
+ case JsString(c) =>
+ try {
+ val intCode = c.toInt
+ // contrast to JsNumber, already parse the string to Int instead of BigInt.
+ StatusCode.int2StatusCode(intCode)
+ } catch {
+ // rethrow NumberFormatException to an unified exception
+ case e: NumberFormatException => throw new Throwable("Illegal code")
Review comment:
s/code/status code/
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services