emscripten-core / emscripten-core/emscripten

A way to catch exception

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

Description

Hi, I am using emsdk 2.0.8 and having hard times to catch exception in my javascript code, in order to be able to detect it other way then having dev tools console open.

My code:

```
const core = await create(...)
const main = core.cwrap('proxy_main', 'number', [...]);
main(...);
```

exception thrown in console:

```
Uncaught RangeError: Invalid atomic access index
at Atomics.store ()
at spawnThread (core.js:9)
at _pthread_create (core.js:9)
at :8080/src/test/resources/:wasm-function[6114]:0x546c48
at ne (:8080/src/test/resources/:wasm-function[3110]:0x276730)
at me (:8080/src/test/resources/:wasm-function[3955]:0x3504ca)
at Worker.worker.onmessage (core.js:9)
```

even having `main(...)` wrapped inside `try-catch` block, I am still unable to catch the exception in my javascript code.

At this point I am not looking for a solution to resolve the exception, but a way how to catch it.

Is there an official way? Maybe I just missed some part of documentation. Thanks.

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.