[FEATURE REQUEST] Server-side uses of unimplemented primitives are difficult to track down
I'm opening this a bit late and I may have forgotten part of the context. Please forgive me if this is the case.
Currently an unimplemented javascript primitive triggers an exit(1) (server-side iirc). This makes it difficult to find which code path is faulty. Mixing server-side and client-side should not happen but mistakes do.
I've used the following change to generate_stubs.sh locally:
-echo "#define D(f) void f () { fprintf(stderr, "Unimplemented Javascript primitive %s!\n", #f); exit(1); }"; +echo "#define D(f) void f () { fprintf(stderr, "Unimplemented Javascript primitive %s!\n", #f); caml_failwith("Unimplemented Javascript primitive: " # f); exit(1); }";
I wasn't able to get a full backtrace but at least I was able to ocamldebug it.
Maybe a dedicated exception could be useful, especially because Invalid_argument might be caught and silenced.
It seems too easy to silently drop an exceptions. I would rather print the backtrace and exit.