Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
src: updating node_api_jsrt to match error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
MSLaguana committed Feb 13, 2018
1 parent a89631e commit 176336f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/node_api_jsrt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ napi_extended_error_info static_last_error;
// Warning: Keep in-sync with napi_status enum
const char* error_messages[] = {
nullptr,
"Invalid pointer passed as argument",
"Invalid argument",
"An object was expected",
"A string was expected",
"A string or symbol was expected",
Expand All @@ -584,17 +584,19 @@ const char* error_messages[] = {
"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",
"Invalid callback scope usage"
};

napi_status napi_get_last_error_info(napi_env env,
const napi_extended_error_info** result) {
CHECK_ARG(result);

static_assert(
node::arraysize(error_messages) == napi_escape_called_twice + 1,
node::arraysize(error_messages) == napi_callback_scope_mismatch + 1,
"Count of error messages must match count of error values");
assert(static_last_error.error_code <= napi_escape_called_twice);
assert(static_last_error.error_code <= napi_callback_scope_mismatch);

// Wait until someone requests the last error information to fetch the error
// message string
Expand Down

0 comments on commit 176336f

Please sign in to comment.