Currently, both in Emscripten and Wasm EH, if you throw an exception, stack traces are not attached by default. This was, at least for Wasm EH, an intentional decision, because Wasm exception itself can be used not only for errors but for other control flow structures with which slowdown can be problematic. Native C++ exceptions don't have stack traces either.
But it is still convenient to see stack traces when debugging. I think we can attach stack traces when in debug / assert mode, by throwing an Error object instead of a raw string in case of Emscripten EH, and turning the optional traceStack option on in the JS API for Wasm EH.
Related request: #17437
Currently, both in Emscripten and Wasm EH, if you throw an exception, stack traces are not attached by default. This was, at least for Wasm EH, an intentional decision, because Wasm exception itself can be used not only for errors but for other control flow structures with which slowdown can be problematic. Native C++ exceptions don't have stack traces either.
But it is still convenient to see stack traces when debugging. I think we can attach stack traces when in debug / assert mode, by throwing an
Errorobject instead of a raw string in case of Emscripten EH, and turning the optionaltraceStackoption on in the JS API for Wasm EH.Related request: #17437