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

Commit

Permalink
n-api: removed napi_status_last usage
Browse files Browse the repository at this point in the history
Removed usage of `napi_status_last` from `node_api_jsrt.cc` and replaced with
`node::array`

PR-URL: #321
Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
  • Loading branch information
kunalspathak authored and kfarnung committed Jul 6, 2017
1 parent 306b517 commit 89800a5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/node_api_jsrt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -348,16 +348,17 @@ const char* error_messages[] = {
"Unknown failure",
"An exception is pending",
"The async work item was cancelled",
"napi_escape_handle already called on scope"
};

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

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

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

0 comments on commit 89800a5

Please sign in to comment.