tonyg/js-nacl

uncaughtException event being handled in nacl_factory.js

jondubois opened this issue · 2 comments

The uncaughtException event is being handled here: https://github.com/tonyg/js-nacl/blob/master/lib/nacl_factory.js#L27 - It checks if the error is of a specific type and if not, it re-throws the error which then crashes the process.

This causes problems if a project has its own uncaughtException handler which tries to handle the uncaughtException in a different way (e.g. in node.js, we may want to exit after some delay instead of immediately).

tonyg commented

That code looks to be Emscripten-generated. What kinds of problems is this causing you? In principle, the C-language portions of this library shouldn't be causing Javascript exceptions at all.

tonyg commented

Sorry, I misunderstood what you meant.

This is definitely to do with how Emscripten is generating code. There seems to be a flag ("NODEJS_CATCH_EXIT") we can set to tell Emscripten not to generate the problematic stanza.