Discussion:
[nodejs] Throw an error from a different thread
Rom Grk
2018-07-10 18:41:02 UTC
Permalink
Hi,

I'm writing GLib bindings with GObject-Introspection for nodejs, and I'm
having an issue with signal handlers (GObject's version of nodejs event
handlers). Basically, the signal callback will be run on a different thread
(in my understanding), and call a JS function. That part is working fine,
but I'm having issues with javascript errors thrown during this callback.
Currently, they're swallowed, and I'd like them to exit the program as an
exception would do in a top-level script.
I've tried to use a `TryCatch` to capture them, but I'm not anymore
advanced because I'd need to re-throw them anyway. I could also just print
the exception message and stack trace and exit the program from the C++
callback, but I was wondering if there was an elegant way to do this.

Thanks,

Romain
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/132689e4-7236-43c3-aff8-38a48d382e44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...