@@ -686,6 +686,34 @@ var DISABLE_EXCEPTION_CATCHING = 1;
686686// [compile+link] - affects user code at compile and system libraries at link
687687var EXCEPTION_CATCHING_ALLOWED = [ ] ;
688688
689+ // Make the exception message printing function, 'getExceptionMessage' available
690+ // in the JS library for use, by adding necessary symbols to EXPORTED_FUNCTIONS
691+ // and DEFAULT_LIBRARY_FUNCS_TO_INCLUDE.
692+ //
693+ // This works with both Emscripten EH and Wasm EH. When you catch an exception
694+ // from JS, that gives you a user-thrown value in case of Emscripten EH, and a
695+ // WebAssembly.Exception object in case of Wasm EH. 'getExceptionMessage' takes
696+ // the user-thrown value in case of Emscripten EH and the WebAssembly.Exception
697+ // object in case of Wssm EH, meaning in both cases you can pass a caught
698+ // exception directly to the function.
699+ //
700+ // When used with Wasm EH, this option additionally provides these functions in
701+ // the JS library:
702+ // - getCppExceptionTag: Returns the C++ tag
703+ // - getCppExceptionThrownObjectFromWebAssemblyException:
704+ // Given an WebAssembly.Exception object, returns the actual user-thrown C++
705+ // object address in Wasm memory.
706+ //
707+ // Setting this option also adds refcount increasing and decreasing functions
708+ // ('incrementExceptionRefcount' and 'decrementExceptionRefcount') in the JS
709+ // library because if you catch an exception from JS, you may need to manipulate
710+ // the refcount manually not to leak memory. What you need to do is different
711+ // depending on the kind of EH you use
712+ // (https://github.com/emscripten-core/emscripten/issues/17115).
713+ //
714+ // See test_exception_message in tests/test_core.py for an example usage.
715+ var EXCEPTION_PRINTING_SUPPORT = false ;
716+
689717// Internal: Tracks whether Emscripten should link in exception throwing (C++
690718// 'throw') support library. This does not need to be set directly, but pass
691719// -fno-exceptions to the build disable exceptions support. (This is basically
0 commit comments