1

I'm trying to port some OCaml tests from OUnit2 to bs-jest, but I get a Not_found exception raised from some test and I don't know where it's coming from; is there a way to enable stack traces in bucklescript?

In OCaml, I would pass the -g option to the compiler, but it doesn't seem to do anything when calling bsc. When an exception is thrown and not caught the program just crashes with no info, and when I catch it and use say Printexc.get_backtrace I get the message "(Program not linked with -g, cannot print stack backtrace)".

Lionel Parreaux
  • 1,115
  • 1
  • 9
  • 22
  • I'm pretty sure bucklescript doesn't support stack traces for "native" exceptions unfortunately. You might be able to raise a JS exception instead and get a stack trace that way though. – glennsl Jul 30 '18 at 21:27

1 Answers1

0

BuckleScript exception handling is a bit weird. Try using the techniques suggested here to replace your exceptions with BS-style exceptions.

chrismamo1
  • 917
  • 1
  • 7
  • 15