pcre-ocaml icon indicating copy to clipboard operation
pcre-ocaml copied to clipboard

Function for printing Pcre exceptions?

Open mjambon opened this issue 3 years ago • 1 comments

I didn't find a function that takes a Pcre.Error exception and prints a human-friendly representation. By default, we're getting Pcre.Error(5) instead of Pcre.Error(RecursionLimit). The plan would be that the user would call Printexc.register_printer Pcre.string_of_exn, or maybe just Pcre.register_exception_printer ().

I'll make a PR if you think that's a good idea.

mjambon avatar Oct 05 '21 00:10 mjambon

Here's an implementation: https://github.com/returntocorp/semgrep/blob/15f082ccedcd4d2c07493e23bc15e72d2cf330f8/semgrep-core/src/core/Pcre_settings.ml#L20-L50

mjambon avatar Oct 05 '21 23:10 mjambon