node/test/addons-napi/test_exception
Gabriel Schulhof b0a3a44ff6
n-api: ensure in-module exceptions are propagated
Whenever we call into an addon, whether it is for a callback, for
module init, or for async work-related reasons, we should make sure
that

* the last error is cleared,
* the scopes before the call are the same as after, and
* if an exception was thrown and captured inside the module, then it is
  re-thrown after the call.

Therefore we should call into the module in a unified fashion. This
change introduces the macro NAPI_CALL_INTO_MODULE() which should be
used whenever invoking a callback provided by the module.

Fixes: https://github.com/nodejs/node/issues/19437
PR-URL: https://github.com/nodejs/node/pull/19537
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2018-04-02 15:14:01 +02:00
..
binding.gyp n-api: add support for abi stable module API 2017-04-03 10:31:25 +02:00
test_exception.c n-api: ensure in-module exceptions are propagated 2018-04-02 15:14:01 +02:00
test.js n-api: ensure in-module exceptions are propagated 2018-04-02 15:14:01 +02:00