Skip to content

Commit

Permalink
src: add napi_handle_scope_mismatch to msg list
Browse files Browse the repository at this point in the history
Backport-PR-URL: #19447
PR-URL: #17161
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Alexey Orlenko <[email protected]>
Reviewed-By: Franziska Hinkelmann <[email protected]>
  • Loading branch information
neta authored and MylesBorins committed Apr 16, 2018
1 parent f4391b9 commit b20c278
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/node_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,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"};

static inline napi_status napi_clear_last_error(napi_env env) {
env->last_error.error_code = napi_ok;
Expand Down Expand Up @@ -940,9 +941,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

0 comments on commit b20c278

Please sign in to comment.