stan-dev / stanc3

The Stan transpiler (from Stan to C++ and beyond).
BSD 3-Clause "New" or "Revised" License
138 stars 44 forks source link

Improve message and handling of internal compiler errors #1408

Closed WardBrian closed 3 months ago

WardBrian commented 4 months ago

We may want to install a top-level exception handler which catches all exceptions, manually prints them and the backtrace, and then outputs the message Fatal error: this should never happen. Please file a bug.... If we did this, we wouldn't even need the Common.FatalError module, just using raise_s everywhere we need would work.

I believe this also would improve the javascript parser, since currently there internal compiler errors manifest as exceptions rather than populating the .error field of the return object