gradle/gradle — pull request #214 by ramonza (2013-11-03 02:43:31+00:00)
Title: Make serialization of errors thrown by tests more robust

My original issue is here: http://forums.gradle.org/gradle/topics/gradle_reports_java_io_streamcorruptedexception_and_freezes_when_running_tests

If I'm being opinionated I think it's not a great idea to try to serialize user-code-thrown exceptions from the Gradle worker into the main Gradle process in the first place. It kinda feels like Gradle tries really hard to keep user code out of the main Gradle daemon and that de-serializing a user exception is a breach of this boundary and now here we are firefighting the consequences of that breach rather than removing it entirely.

Yes, `catch(Throwable)` is scary. The reason for them (as I've tried to put forward in comments) is that we're calling into user code (user _testing_ code no less) at places where, if we fail, the build breaks in really ugly ways or worse - spuriously succeeds.