Reputation: 1287
It is widely known that a huge chunk of standard OCaml functions and a lot of common stdlib and 3rd party libraries are often contain functions that can throw exceptions. It can be very tricky to handle, especially if most of the program is written in a functional way. Are there any ways or tools to list/catch all the functions that throw exceptions by auditing the sources?
Upvotes: 4
Views: 173
Reputation: 10158
There has been an attempt to build a static analyzer for exceptions, located at https://github.com/OCamlPro/ocp-analyzer. However, last time I checked it crashed even on very simple programs and that the repository consists in a single commit, I'd say that it might be useful only as a starting point for writing a proper analyzer.
Upvotes: 2
Reputation: 896
Best solution I know is to use ocp-grep
:
ocp-grep Pervasives.raise
Upvotes: 3