node/test/addons-napi/test_exception
Gabriel Schulhof 92f699e021 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
Backport-PR-URL: https://github.com/nodejs/node/pull/19265
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-05-01 17:16:36 -04:00
..
binding.gyp
test.js n-api: ensure in-module exceptions are propagated 2018-05-01 17:16:36 -04:00
test_exception.c n-api: ensure in-module exceptions are propagated 2018-05-01 17:16:36 -04:00