Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
package io.javaoperatorsdk.operator;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class AggregatedOperatorException extends OperatorException {

private final List<Exception> causes;

public AggregatedOperatorException(String message, Exception... exceptions) {
super(message);
this.causes = exceptions != null ? Arrays.asList(exceptions) : Collections.emptyList();
super(message, exceptions[0]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might NPE if no exception is passed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pushed with null check

this.causes = Arrays.asList(exceptions);
}

public AggregatedOperatorException(String message, List<Exception> exceptions) {
super(message);
this.causes = exceptions != null ? exceptions : Collections.emptyList();
super(message, exceptions.get(0));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, we need to check that the given parameter is not null…

this.causes = exceptions;
}

public List<Exception> getAggregatedExceptions() {
return causes;
}

@Override
public String toString() {
return "AggregatedOperatorException{" +
"causes=" + causes +
'}';
}
}