Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Napi handle scope mismatch #17161

Closed
Closed
7 changes: 4 additions & 3 deletions src/node_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,8 @@ const char* error_messages[] = {nullptr,
"Unknown failure",
"An exception is pending",
"The async work item was cancelled",
"napi_escape_handle already called on scope"};
"napi_escape_handle already called on scope",
"invalid handle scope usage"};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalize "invalid" in accordance with the rest of error_messages.

The one immediately before this one is an exception, as napi_escape_handle is the name of a function, and function names are case-sensitive.


static inline napi_status napi_clear_last_error(napi_env env) {
env->last_error.error_code = napi_ok;
Expand Down Expand Up @@ -929,9 +930,9 @@ napi_status napi_get_last_error_info(napi_env env,
// We don't have a napi_status_last as this would result in an ABI
// change each time a message was added.
static_assert(
node::arraysize(error_messages) == napi_escape_called_twice + 1,
node::arraysize(error_messages) == napi_handle_scope_mismatch + 1,
"Count of error messages must match count of error values");
CHECK_LE(env->last_error.error_code, napi_escape_called_twice);
CHECK_LE(env->last_error.error_code, napi_handle_scope_mismatch);

// Wait until someone requests the last error information to fetch the error
// message string
Expand Down
12 changes: 2 additions & 10 deletions tools/doc/node_modules/js-yaml/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.