xyncro / chiron

JSON for F#
https://xyncro.tech/chiron
MIT License
175 stars 41 forks source link

Better error messages for missing JSON Object members #53

Closed neoeinstein closed 8 years ago

neoeinstein commented 8 years ago

Bask in the glory of error messages like:

"Error deserializing JSON object; Missing required member 'values': { "json": { "hello": "world" }, "number": 42, "string": "hello" }"

Instead of:

"Couldn't use Prism (<fun:op_GreaterQmarkGreater@190-4>, <fun:op_GreaterQmarkGreater@191-5>) on JSON: 'Object
  (map
     [("json", Object (map [("hello", String "world")])); ("number", Number 42M);
      ("string", String "hello")])'"
kolektiv commented 8 years ago

Awesome! Merged in to the 6.0.0-rc4 which is building in CI as I speak. Should be pushed out shortly. Thinking of releasing new 8.0 and 6.0 of Aether and Chiron this weekend, as they seem pretty solid having played with them a bit. The newer APIs are nice, and the backwards compatibility layer seems reasonably good.

neoeinstein commented 8 years ago

I'm thinking of adding some additional messaging around some of the other Prism issues. The required member one is the most common, but I also want to get better messages when, for example, Json.Null is found when we are expecting Json.Number. Eventually working back up to adding even better error messaging in the FParsec parser.

kolektiv commented 8 years ago

That would be fantastic. I guess those are unlikely to be breaking changes though, so if I released an 8.0.0 they could always be an 8.0.1? Quite keen to get a release out, and I don't want to put pressure on you! :)

I'll take a look at better parser errors too - that shouldn't be too hard, just a question of some different error reporting combinators - I'd always meant to get round to that!

neoeinstein commented 8 years ago

Yes. Better error messages should be internal changes only and non-breaking.