I think I need some human input here :) I have a simple CPP code:
#include <stdexcept>
#include <emscripten/bind.h>
using namespace emscripten;
double add(double a, double b)
{
if(a>5)
throw std::runtime_error("big a");
return a+b;
}
EMSCRIPTEN_BINDINGS(my_module) {
function("add", &add);
}
I compile this simple example with:
emcc -lembind -o quick_example.js quick_example.cpp -fexceptions -sDISABLE_EXCEPTION_CATCHING=0 -O2
When I catch the error in JavaScript, it prints out weird numbers instead of the error message. I can only see the error message when not using any level of optimization. What am I missing here.