Last active
August 29, 2015 14:18
-
-
Save huntc/8c886ec989d58924beb8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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