Skip to content

Commit 6428502

Browse files
authored
aggregate exception improvement (#1188)
1 parent 97cdcb7 commit 6428502

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/AggregatedOperatorException.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,27 @@
55
import java.util.List;
66

77
public class AggregatedOperatorException extends OperatorException {
8+
89
private final List<Exception> causes;
910

1011
public AggregatedOperatorException(String message, Exception... exceptions) {
11-
super(message);
12+
super(message, exceptions != null && exceptions.length > 0 ? exceptions[0] : null);
1213
this.causes = exceptions != null ? Arrays.asList(exceptions) : Collections.emptyList();
1314
}
1415

1516
public AggregatedOperatorException(String message, List<Exception> exceptions) {
16-
super(message);
17+
super(message, exceptions != null && !exceptions.isEmpty() ? exceptions.get(0) : null);
1718
this.causes = exceptions != null ? exceptions : Collections.emptyList();
1819
}
1920

2021
public List<Exception> getAggregatedExceptions() {
2122
return causes;
2223
}
24+
25+
@Override
26+
public String toString() {
27+
return "AggregatedOperatorException{" +
28+
"causes=" + causes +
29+
'}';
30+
}
2331
}

0 commit comments

Comments
 (0)