ocaml-asn1-combinators
ocaml-asn1-combinators copied to clipboard
Signalling encode errors
Currently none of the terms in Asn.S will error when encoding. For the string types and utc_time the input is assumed to be valid when encoding (see also #39 for previous discussion). In #39 I proposed signalling an error when encoding a Ptime.t as utc_time outside the valid range.
It may make sense to define an exception in asn1-combinators for signalling encode errors rather than using ad hoc exceptions.
In albatross an error, although unlikely, is signalled with a Failure _ exception: https://github.com/robur-coop/albatross/blob/2f316d2e49866fe08b9e12c12194062bbbaa2329/src/vmm_asn.ml#L384-L402
Otherwise I have not found other occurrences of signalling errors when encoding from a brief survey.