emscripten-core / emscripten-core/emscripten

Better native exception handling in threads

Open
#10,182 6 comments 0 reactions 0 assignees View on GitHub
wontfix
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Currently when a thread is started we do :
```
try {
var result = Module['dynCall_ii'](e.data.start_routine, e.data.arg);
} catch (e) {
//handling
}
```

This works fine for JS errors, but it looks like Module.dynCall_ii() can also throw native error objects, which just get resolved to a pointer. This gives us unhelpful messages like:
`worker.js onmessage() captured an uncaught exception: {pointer}`
I'm sure there's a way to call into the native code and get some useful information out of the error, at a minimum something like:
```
static char* GetExceptionMessage(std::exception e) {return e.what()}
```
could provide valuable information.

I suspect that there is already something like this in Emscripten, is this the case?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.