cbor: full Error refactor over Loc.Error
Replace the inline custom Error module with a proper facade over
Loc.Error, following the ocaml-encodings skill:
- Typed kinds extend Loc.Error.kind (Type_mismatch, Missing_member,
Unknown_member, Duplicate_member, Out_of_range, Invalid_value,
Parse_error, Custom, Sort_mismatch, Kinded_sort_mismatch). Printers
registered at module init. Callers pattern-match on Loc.Error.kind.
- CBOR-native path steps Cbor_key (non-string map keys) and Cbor_tag
(tagged-value boundary) extend Loc.Path.step, printed via the step
registry. Mem/Nth cover string keys and array indices.
- Error.t = Loc.Error.t; custom Error.Decode exception deleted (raise
Loc.Error.Error instead). Paths use Loc.Context.t throughout the
codec interpreters.
- Context builders ctx_with_index / ctx_with_key / ctx_with_cbor_key /
ctx_with_tag descend one step in a context; replace the old cons-on-
list path threading (Error.Index i :: path → Error.ctx_with_index i
path).
- Typed raising helpers (type_mismatch, missing_member, ...) and the
shape-error menu (sort, kinded_sort, expected, missing_mems, ...)
match the other encoding libraries' facade shape.
Update ocaml-bpsec fuzz harness to catch Loc.Error instead of
Cbor.Error.Decode. External callers (cose, jwt, scitt, mst, space-dtn)
only use Cbor.Error.pp / to_string, which still work through the
facade.