Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@huntc
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huntc/8c886ec989d58924beb8 to your computer and use it in GitHub Desktop.
Save huntc/8c886ec989d58924beb8 to your computer and use it in GitHub Desktop.
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