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.

Reply via email to