CORDA-3309: Remove explicit try-catch in favour of UncaughtExceptionHandler. (#91)

This commit is contained in:
Chris Rankin 2019-10-09 09:45:44 +01:00 committed by GitHub
parent 90c2f7f129
commit 83ad11f21b

View File

@ -92,18 +92,14 @@ abstract class TestBase(type: SandboxType) {
) {
var thrownException: Throwable? = null
thread(start = false) {
try {
UserPathSource(classPaths).use { userSource ->
SandboxRuntimeContext(parentConfiguration.createChild(userSource, Consumer {
it.withNewMinimumSeverityLevel(minimumSeverityLevel)
.withSandboxOnlyAnnotations(sandboxOnlyAnnotations)
.withVisibleAnnotations(visibleAnnotations)
})).use {
action(this)
}
UserPathSource(classPaths).use { userSource ->
SandboxRuntimeContext(parentConfiguration.createChild(userSource, Consumer {
it.withNewMinimumSeverityLevel(minimumSeverityLevel)
.withSandboxOnlyAnnotations(sandboxOnlyAnnotations)
.withVisibleAnnotations(visibleAnnotations)
})).use {
action(this)
}
} catch (exception: Throwable) {
thrownException = exception
}
}.apply {
uncaughtExceptionHandler = Thread.UncaughtExceptionHandler { _, ex ->