emscripten-core / emscripten-core/emscripten
We need a better way to handle node.js + pthreads errors
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
With the changes made in #9863 errors in a node.js pthread are reported like `pthread sent an error! undefined:undefined: Module is not a function`.
This could be more helpful, it would be good to get a line number and file like we do in the web case. At a minimum `undefined:undefined` should go.
My suggestion would be to replace
https://github.com/emscripten-core/emscripten/blob/408a6e9411165fdfd3c18163f37ee302e751857d/src/library_pthread.js#L441
with `err('pthread sent an error!\n' + data.stack);`. This will print out something like:
```
pthread sent an error!
TypeError: Module is not a function
at onmessage (/path/module.worker.js:93:16)
[stacktrace continues]
```
This is slightly more helpful. However I'm not familiar enough with node to know if there's something better.
Anyone have any better ideas?
Contributor guide
Assessment
This issue has not been assessed yet.