Created
May 11, 2013 16:49
-
-
Save ldaley/5560577 to your computer and use it in GitHub Desktop.
This file contains 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 "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