Skip to content

Commit

Permalink
Merge pull request #250 from gemini-hlsw/not-a-leaf
Browse files Browse the repository at this point in the history
improve error message
  • Loading branch information
milessabin authored Aug 11, 2022
2 parents 4a5db39 + a95c76c commit b8c5ed2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/sql/src/main/scala/SqlMapping.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3061,7 +3061,9 @@ trait SqlMapping[F[_]] extends CirceMapping[F] with SqlModule[F] { self =>
def isLeaf: Boolean = tpe.isLeaf

def asLeaf: Result[Json] =
mapped.encoderForLeaf(tpe).map(enc => enc(focus).rightIor).getOrElse(mkErrorResult(s"Not a leaf: $focus"))
mapped.encoderForLeaf(tpe).map(enc => enc(focus).rightIor).getOrElse(mkErrorResult(
s"Cannot encode value $focus at ${context.path.reverse.mkString("/")} (of GraphQL type ${context.tpe}). Did you forget a LeafMapping?".stripMargin.trim
))

def isList: Boolean =
tpe match {
Expand Down

0 comments on commit b8c5ed2

Please sign in to comment.