This is quite interesting. I presume this requires the exception to be based on std::exception? If we could reliably detect this, it would probably make sense to make this a built-in feature, since the meaning of the thrown integers have been a common source of questions. Marked this down as https://github.com/kripken/emscripten/issues/4456
2016-07-12 1:05 GMT+03:00 Charles Vaughn <[email protected]>: > I'm posting a snippet I use to convert the obscure exceptions messages > when exception handling is disabled to a string value. Since this relies on > re-entering the Emscripten environment after its in a bad state, it's > possible that some exceptions can't be dumped this way, but for those that > return simple strings, it should work. > > It works by looking up the 'what' function in the exceptions vtable. > > function whatEmscriptenException(ptr) { > // 8 should be the vtable offset for the what function > var fPtr = Module.HEAPU32[(Module.HEAPU32[(ptr) >> 2] + 8) >> 2]; > console.info(Module.AsciiToString(Module.dynCall_ii(fPtr, ptr))); > } > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
