Skip to content

Instantly share code, notes, and snippets.

@ldaley
Created May 11, 2013 16:49
Show Gist options
  • Save ldaley/5560577 to your computer and use it in GitHub Desktop.
Save ldaley/5560577 to your computer and use it in GitHub Desktop.
def "can handle errors on forked threads"() {
given:
def errorHandler = new ErrorHandlingContext() {
void error(Exchange exchange, Exception exception) {
exchange.response.send("Caught: $exception.message")
}
}
when:
app {
routing {
context(errorHandler) {
get {
withErrorHandling new Thread({
throw new Exception("thrown in forked thread")
})
}
}
}
}
then:
urlGetText() == "Caught: thrown in forked thread"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment