Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Argonaut error messages.
scala> Json("k" := Json("m" := 7))
res1: argonaut.Json = {"k":{"m":7}}
scala> (res1.hcursor --\ "p").as[String]
res2: argonaut.DecodeResult[String] = DecodeResult(-\/((Attempt to decode value on failed cursor.,CursorHistory([*.--\(p)]))))
scala> (res1.hcursor --\ "k" --\ "m").as[String]
res3: argonaut.DecodeResult[String] = DecodeResult(-\/((String,CursorHistory([--\(m),--\(k)]))))
scala> (res1.hcursor --\ "k" --\ "m").as[Int]
res4: argonaut.DecodeResult[Int] = DecodeResult(\/-(7))
scala> (res1.hcursor --\ "k" --\ "m").as[List[String]]
res5: argonaut.DecodeResult[List[String]] = DecodeResult(-\/(([A]List[A],CursorHistory([--\(m),--\(k)]))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment