It's a current limitation of Emscripten JS-based exception handling.

The details on why, just in case anyone is interested:
So every time we call a possibly-throwing function, we call out to a JS
function (named 'invoke_SIG' where SIG is the signature string of the
function) that calls the actual throwing function, and after catching the
exception, sets some variables for future processing and returns to the
original calling function. And the original calling function checks those
variables, runs destructors if any, and does the necessary thing depending
on what the exception's type and the calling code is.

The limitation of JS-based EH is, those 'invoke_SIG' functions are
structured like this:
function invoke_v(index) {
  var sp = stackSave();
  try {
    getWasmTableEntry(index)();
  } catch(e) {
    stackRestore(sp);
    if (!(e instanceof EmscriptenEH)) throw e;
    _setThrew(1, 0);
  }
}

So basically, unless the exception is a C++ exception ('EmscriptenEH' in
the code means that), the JS code just rethrows the exception to be caught
by other functions in the call stack, preventing the function from
returning to the original caller function.

I think it would be better to be documented in our exception docs; I'll
work on it.

-- 
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 emscripten-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CALJpS1N6Nt%3DQ88m0u9D1WK9WZZZ6smdnkCo6ZO7z32Gq54ZFsA%40mail.gmail.com.

Reply via email to