Skip to content

Instantly share code, notes, and snippets.

@huntc huntc/Application.scala
Last active Aug 29, 2015

Embed
What would you like to do?
def render(project: Project.Value, path: String) = EssentialAction { rh =>
val futureAction = project match {
case Project.ConductR =>
conductrDocRenderer.actorRef
.ask(DocRenderer.Render(path))(settings.doc.renderer.timeout)
.map {
case html: Html => Action(Ok(html))(rh)
case action: Action[AnyContent] => action(rh)
case DocRenderer.NotFound(p) => Action(NotFound(s"Cannot find $p"))(rh)
case DocRenderer.NotReady => Action(ServiceUnavailable("Initializing documentation. Please try again in a minute."))(rh)
}
.recover {
case _: AskTimeoutException => Action(InternalServerError)(rh)
}
}
Iteratee.flatten(futureAction)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.