Skip to content

Commit

Permalink
Do not try to parse the result when data is None
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostdogpr committed Jun 16, 2021
1 parent 585d372 commit f705935
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/src/main/scala/caliban/client/SelectionBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ sealed trait SelectionBuilder[-Origin, +A] { self =>
.decode[GraphQLResponse](payload)
.left
.map(ex => DecodingError("Json deserialization error", Some(ex)))
data <- if (parsed.errors.nonEmpty && parsed.data.contains(__Value.__NullValue)) Left(ServerError(parsed.errors))
data <- if (parsed.errors.nonEmpty && parsed.data.forall(_ == __Value.__NullValue))
Left(ServerError(parsed.errors))
else Right(parsed.data)
objectValue <- data match {
case Some(o: __ObjectValue) => Right(o)
Expand Down

0 comments on commit f705935

Please sign in to comment.