n-api: emit uncaught-exception on calling into modules
Currently, those exceptions were swallowed and the execution may continue in an unstable state.
Following cases are covered in the PR that exceptions can be thrown on calling into modules:
- TSFN callbacks
- Finalizers
Fixes: https://github.com/nodejs/node/issues/36402
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines