@@ -34,11 +34,12 @@ class BufferFinalizer: private Finalizer {
3434 static void FinalizeBufferCallback (char * data, void * hint) {
3535 BufferFinalizer* finalizer = static_cast <BufferFinalizer*>(hint);
3636 if (finalizer->_finalize_callback != nullptr ) {
37- NAPI_CALL_INTO_MODULE_THROW (finalizer->_env ,
37+ NapiCallIntoModuleThrow (finalizer->_env , [&]() {
3838 finalizer->_finalize_callback (
3939 finalizer->_env ,
4040 data,
41- finalizer->_finalize_hint ));
41+ finalizer->_finalize_hint );
42+ });
4243 }
4344
4445 Delete (finalizer);
@@ -465,8 +466,9 @@ void napi_module_register_by_symbol(v8::Local<v8::Object> exports,
465466 napi_env env = v8impl::GetEnv (context);
466467
467468 napi_value _exports;
468- NAPI_CALL_INTO_MODULE_THROW (env,
469- _exports = init (env, v8impl::JsValueFromV8LocalValue (exports)));
469+ NapiCallIntoModuleThrow (env, [&]() {
470+ _exports = init (env, v8impl::JsValueFromV8LocalValue (exports));
471+ });
470472
471473 // If register function returned a non-null exports object different from
472474 // the exports object we passed it, set that as the "exports" property of
@@ -874,14 +876,14 @@ class Work : public node::AsyncResource, public node::ThreadPoolWork {
874876 // stored.
875877 napi_env env = _env;
876878
877- NAPI_CALL_INTO_MODULE (env,
878- _complete (_env, ConvertUVErrorCode (status), _data),
879- [env] (v8::Local<v8::Value> local_err) {
880- // If there was an unhandled exception in the complete callback,
881- // report it as a fatal exception. (There is no JavaScript on the
882- // callstack that can possibly handle it.)
883- v8impl::trigger_fatal_exception (env, local_err);
884- });
879+ NapiCallIntoModule (env, [&]() {
880+ _complete (_env, ConvertUVErrorCode (status), _data);
881+ }, [env](v8::Local<v8::Value> local_err) {
882+ // If there was an unhandled exception in the complete callback,
883+ // report it as a fatal exception. (There is no JavaScript on the
884+ // callstack that can possibly handle it.)
885+ v8impl::trigger_fatal_exception (env, local_err);
886+ });
885887
886888 // Note: Don't access `work` after this point because it was
887889 // likely deleted by the complete callback.
0 commit comments