Skip to content

Commit 25efd1c

Browse files
zsxwingakarnokd
authored andcommitted
Don't wrap with CompositeException when there is only one error (#4631)
1 parent a30fb4d commit 25efd1c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/io/reactivex/observers/BaseTestConsumer.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,12 @@ protected final AssertionError fail(String message) {
132132

133133
AssertionError ae = new AssertionError(b.toString());
134134
if (!errors.isEmpty()) {
135-
CompositeException ce = new CompositeException(errors);
136-
ae.initCause(ce);
135+
if (errors.size() == 1) {
136+
ae.initCause(errors.get(0));
137+
} else {
138+
CompositeException ce = new CompositeException(errors);
139+
ae.initCause(ce);
140+
}
137141
}
138142
return ae;
139143
}

0 commit comments

Comments
 (0)