comlink icon indicating copy to clipboard operation
comlink copied to clipboard

Full stack traces

Open buu700 opened this issue 3 years ago • 0 comments

As-is, the thread boundary is very problematic for debugging client-side JavaScript.

If, for example, we have a function balls that calls into a thread via comlink, from what I can tell the stack data is basically lost every time we run balls(). If an error occurs within the thread, it'll print a stack trace with nothing of value until after the self.onmessage line, i.e. it drops the entire calling context of balls() and shows only what's inside the thread. If an error occurs at some point after await balls();, it'll likewise make it look as though window.onmessage had fired out of the blue with the same information missing.

I'm surprised that this hasn't been brought up much (if at all) before, considering what a major problem it is, at least for us. We've thought about trying to improve this on our end with some logging or ideally even altering the stack trace, but aren't sure what the best approach would be and would rather have every Comlink user benefit than deal with building a one-off bespoke solution.

buu700 avatar Jun 12 '21 07:06 buu700