Skip to content

Commit

Permalink
[#1965] Filter out the null elements from the list of errors in Graph…
Browse files Browse the repository at this point in the history
…QLClientException
  • Loading branch information
api-from-the-ion authored and jmartisk committed Nov 15, 2023
1 parent e1fabe8 commit b19c846
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package io.smallrye.graphql.client;

import static java.util.Collections.singletonList;
import static java.util.Objects.requireNonNull;
import static java.util.stream.Collectors.joining;

import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* Represents a response that contained application-level errors and thus can't be turned into a domain object.
Expand All @@ -17,12 +19,12 @@ public class GraphQLClientException extends RuntimeException {

public GraphQLClientException(String message, GraphQLError error) {
super(message);
this.errors = Collections.singletonList(requireNonNull(error));
this.errors = singletonList(requireNonNull(error));
}

public GraphQLClientException(String message, List<GraphQLError> errors) {
super(message);
this.errors = requireNonNull(errors);
this.errors = requireNonNull(errors).stream().filter(Objects::nonNull).collect(Collectors.toList());
}

@Override
Expand Down

0 comments on commit b19c846

Please sign in to comment.