Skip to content

Commit

Permalink
[smallrye#1965] Filter out the null elements from the list of errors …
Browse files Browse the repository at this point in the history
…in GraphQLClientException
  • Loading branch information
api-from-the-ion committed Nov 14, 2023
1 parent 7bdfb31 commit bb7d10c
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 bb7d10c

Please sign in to comment.