Skip to content

Missing status message list update for napi_handle_scope_mismatch #16973

Closed
@RReverser

Description

  • Subsystem: n-api

Unless I'm missing something, #16201 should've also updated

node/src/node_api.cc

Lines 927 to 934 in c5a49e1

// you must update this assert to reference the last message
// in the napi_status enum each time a new error message is added.
// 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,
"Count of error messages must match count of error values");
CHECK_LE(env->last_error.error_code, napi_escape_called_twice);
and

node/src/node_api.cc

Lines 889 to 901 in c5a49e1

const char* error_messages[] = {nullptr,
"Invalid argument",
"An object was expected",
"A string was expected",
"A string or symbol was expected",
"A function was expected",
"A number was expected",
"A boolean was expected",
"An array was expected",
"Unknown failure",
"An exception is pending",
"The async work item was cancelled",
"napi_escape_handle already called on scope"};
, as currently assertion at
CHECK_LE(env->last_error.error_code, napi_escape_called_twice);
will fail whenever someone tries to call napi_get_last_error_info right after napi_handle_scope_mismatch occurred.

Metadata

Assignees

No one assigned

    Labels

    c++Issues and PRs that require attention from people who are familiar with C++.good first issueIssues that are suitable for first-time contributors.node-apiIssues and PRs related to the Node-API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions