From f9bbad871acf294d78dfc74205e2f0e9fc1fa692 Mon Sep 17 00:00:00 2001 From: legendecas Date: Mon, 14 Dec 2020 19:10:51 +0800 Subject: [PATCH] n-api: emit uncaught-exception on unhandled tsfn callbacks --- doc/api/cli.md | 7 ++ src/js_native_api_v8.h | 25 +++-- src/node_api.cc | 97 ++++++++++++------- src/node_options.cc | 4 + src/node_options.h | 1 + .../test_reference/test_finalizer.js | 20 ++++ .../test_reference/test_reference.c | 41 ++++++++ test/node-api/test_buffer/test_buffer.c | 36 +++++++ test/node-api/test_buffer/test_finalizer.js | 21 ++++ .../test_threadsafe_function/binding.c | 30 ++++++ .../test_no_force_uncaught_exception.js | 22 +++++ .../test_uncaught_exception.js | 26 +++++ 12 files changed, 282 insertions(+), 48 deletions(-) create mode 100644 test/js-native-api/test_reference/test_finalizer.js create mode 100644 test/node-api/test_buffer/test_finalizer.js create mode 100644 test/node-api/test_threadsafe_function/test_no_force_uncaught_exception.js create mode 100644 test/node-api/test_threadsafe_function/test_uncaught_exception.js diff --git a/doc/api/cli.md b/doc/api/cli.md index 5373f97fca07a9..3239d368419646 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -585,6 +585,13 @@ added: v9.0.0 Disables runtime checks for `async_hooks`. These will still be enabled dynamically when `async_hooks` is enabled. +### `--no-force-napi-uncaught-exception-policy` + + +Disables 'uncaughtException' event on N-API asynchronous callbacks. + ### `--no-warnings`