diff --git a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/AggregatedOperatorException.java b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/AggregatedOperatorException.java index 2e1247dd8f..4600c2c5e4 100644 --- a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/AggregatedOperatorException.java +++ b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/AggregatedOperatorException.java @@ -5,19 +5,27 @@ import java.util.List; public class AggregatedOperatorException extends OperatorException { + private final List causes; public AggregatedOperatorException(String message, Exception... exceptions) { - super(message); + super(message, exceptions != null && exceptions.length > 0 ? exceptions[0] : null); this.causes = exceptions != null ? Arrays.asList(exceptions) : Collections.emptyList(); } public AggregatedOperatorException(String message, List exceptions) { - super(message); + super(message, exceptions != null && !exceptions.isEmpty() ? exceptions.get(0) : null); this.causes = exceptions != null ? exceptions : Collections.emptyList(); } public List getAggregatedExceptions() { return causes; } + + @Override + public String toString() { + return "AggregatedOperatorException{" + + "causes=" + causes + + '}'; + } }