Github user shimamoto commented on a diff in the pull request:

    
https://github.com/apache/incubator-predictionio/pull/425#discussion_r135180795
  
    --- Diff: 
data/src/main/scala/org/apache/predictionio/data/api/Webhooks.scala ---
    @@ -62,22 +53,23 @@ private[predictionio] object Webhooks {
         }
     
         eventFuture.flatMap { eventOpt =>
    -      if (eventOpt.isEmpty) {
    -        Future successful {
    -          val message = s"webhooks connection for ${web} is not supported."
    -          (StatusCodes.NotFound, Map("message" -> message))
    -        }
    -      } else {
    -        val event = eventOpt.get
    -        val data = eventClient.futureInsert(event, appId, channelId).map { 
id =>
    -          val result = (StatusCodes.Created, Map("eventId" -> s"${id}"))
    -
    -          if (stats) {
    -            statsActorRef ! Bookkeeping(appId, result._1, event)
    +      eventOpt match {
    +        case None =>
    +          Future successful {
    +            val message = s"webhooks connection for ${web} is not 
supported."
    +            (StatusCodes.NotFound, Map("message" -> message))
    --- End diff --
    
    It's better to use in function args for pattern matching.
    
    ```scala
    eventFuture.flatMap {
      case None => ...
      case Some(event) => ...
    }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to