mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
5d432d6bb9
This was a pending TODO: now the Catala program compiled into OCaml should return better messages and a little more information about uncaught exceptions. Note that this also concerns, at the moment, compiled modules called from the Catala interpreter: in this case, it's already better than nothing, but what we need is proper interoperation between the runtime exceptions and the interpreter handling (`EmptyError` should already be handled properly since it is critical to the computation flow, but "error" exceptions are left uncaught and will kill the interpreter). This may be part of a bigger task on unifying the output of the runtime and toplevel, which also concerns computation traces. Note 2: All runtime exceptions don't have a position available, which is quite unfortunate when your program hits an error. With `OCAMLRUNPARAM=b` and if compiled with `-g` (which should normally be the case), you can get an OCaml backtrace but that's not very friendly. Ideas for improvement: - The runtime could force-enable backtrace recording (`Printexc.record_backtrace true`) to supersede the need for `OCAMLRUNPARAM`. We can also record our own handler to print the file position and/or backtrace in the way we see fit - The printer of OCaml code in Catala could insert line directives so that the positions in the backtrace actually trace automatically back to the Catala code - If we don't want to leverage any OCaml machinery in this way, the compiler should add position information to any operator that might fail (e.g. divisions, date comparisons, etc.). Note that running in trace mode might already help pinpoint the location of the error ? |
||
---|---|---|
.. | ||
catala_utils | ||
dcalc | ||
desugared | ||
lcalc | ||
literate | ||
plugins | ||
scalc | ||
scopelang | ||
shared_ast | ||
surface | ||
verification | ||
catala_web_interpreter.ml | ||
catala.ml | ||
driver.ml | ||
driver.mli | ||
dune | ||
index.mld | ||
plugin.ml | ||
plugin.mli | ||
tests.ml |