rabbah commented on a change in pull request #2218: Port Controller from Spray
to Akka
URL:
https://github.com/apache/incubator-openwhisk/pull/2218#discussion_r132813861
##########
File path:
core/controller/src/main/scala/whisk/core/controller/Activations.scala
##########
@@ -184,33 +184,30 @@ trait WhiskActivationsApi
(activation: WhiskActivation) => activation.logs.toJsonObject)
}
- /** Custom deserializer for query parameters "name" into valid entity
name. */
- private implicit val stringToEntityName = new
FromStringDeserializer[EntityName] {
- def apply(value: String): Either[DeserializationError, EntityName] = {
+ /** Custom unmarshaller for query parameters "name" into valid entity
name. */
+ private implicit val stringToEntityName: Unmarshaller[String, EntityName] =
+ Unmarshaller.strict[String, EntityName] { value =>
Try { EntityName(value) } match {
- case Success(e) => Right(e)
- case Failure(t) => Left(MalformedContent(t.getMessage))
+ case Success(e) => e
+ case Failure(t) => throw new
IllegalArgumentException(s"Parameter is not a valid value for a entity name:
$value")
Review comment:
i'd move all three throw here to messages to Messages.
----------------------------------------------------------------
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