in src/main/scala/managehelpcontentpublisher/Handler.scala [24:38]
def buildResponse(context: Context, result: Either[Failure, Seq[PathAndContent]]): APIGatewayProxyResponseEvent =
result match {
case Left(RequestFailure(reason)) =>
logError(context, reason)
new APIGatewayProxyResponseEvent().withStatusCode(400).withBody(reason)
case Left(NotFoundFailure) =>
logError(context, NotFoundFailure.reason)
new APIGatewayProxyResponseEvent().withStatusCode(404)
case Left(ResponseFailure(reason)) =>
logError(context, reason)
new APIGatewayProxyResponseEvent().withStatusCode(500).withBody(reason)
case Right(published) =>
published.foreach(logPublished(context))
new APIGatewayProxyResponseEvent().withStatusCode(204)
}