Skip to content

Commit a601d72

Browse files
committed
Preserve exception in TimeoutInterceptor...
in case of an interrupt during sync. Previously, the `InterruptedException` replaced the potential prior exception.
1 parent a7dedb4 commit a601d72

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spock-core/src/main/java/org/spockframework/runtime/extension/builtin/TimeoutInterceptor.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,11 @@ public void intercept(final IMethodInvocation invocation) throws Throwable {
110110
// As this won't take long, it should also be acceptable if this thread
111111
// got interrupted by some other thread. To report on the latter case,
112112
// we save off the exception, overriding any previously saved exception.
113-
saved = e;
113+
if (saved != null) {
114+
saved.addSuppressed(e);
115+
} else {
116+
saved = e;
117+
}
114118
}
115119
}
116120
if (stackTrace.length > 0) {

0 commit comments

Comments
 (0)