Skip to content

Commit

Permalink
Merge pull request #30490 from gsmet/fix-self-suppression
Browse files Browse the repository at this point in the history
Avoid adding the exception itself as a suppressed exception
  • Loading branch information
gsmet authored Jan 20, 2023
2 parents 051f0c5 + cec7cd3 commit 2369fb1
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,13 @@ public void interceptTestMethod(Invocation<Void> invocation, ReflectiveInvocatio
runExtensionMethod(invocationContext, extensionContext, true);
invocation.skip();
} catch (Throwable t) {
for (var i : serverExceptions) {
t.addSuppressed(i);
for (var serverException : serverExceptions) {
if (t == serverException) {
// do not add a suppressed exception to itself
continue;
}

t.addSuppressed(serverException);
}
throw t;
} finally {
Expand Down

0 comments on commit 2369fb1

Please sign in to comment.