ocaml-json: unify Error with ocaml-loc
Rebase Json.Error entirely on Loc.Error:
- [type kind] is now Loc.Error.kind (extensible) instead of a tagged
string. Kind extensions registered here use the Loc.Error printer
registry and are pattern-matchable from anywhere that knows about
them.
- [type t] is Loc.Error.t.
- Module Context is Loc.Error.Context.
- exception Error is rebound to Loc.Error so catching either works
transparently across all codecs sharing the loc vocabulary.
- Constructors/raisers follow the loc API: [v] / [msg] construct,
[raise] / [fail] / [failf] raise. The old [make_msg] / [msg (as raiser)]
/ [msgf] names are gone from the public API; callers updated.
Two JSON-specific typed kinds registered at load time:
- [Sort_mismatch of { exp; fnd }] for sort errors (exp: Sort.t, fnd:
Sort.t)
- [Kinded_sort_mismatch of { exp; fnd }] for kinded-sort errors (exp:
string label, fnd: Sort.t)
Helpers [Error.sort] and [Error.kinded_sort] now raise the typed kinds
directly; consumers matching on specific error shapes can pattern-match
instead of doing substring matching on the formatted message.