Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/node_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ napi_status napi_get_last_error_info(napi_env env,
error_messages[env->last_error.error_code];

*result = &(env->last_error);
return napi_clear_last_error(env);
return napi_ok;
}

napi_status napi_create_function(napi_env env,
Expand Down
8 changes: 8 additions & 0 deletions test/addons-napi/test_napi_status/test_napi_status.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ napi_value createNapiError(napi_env env, napi_callback_info info) {

NAPI_ASSERT(env, status != napi_ok, "Failed to produce error condition");

const napi_extended_error_info *error_info = 0;
NAPI_CALL(env, napi_get_last_error_info(env, &error_info));

NAPI_ASSERT(env, error_info->error_code == status,
"Last error info code should match last status");
NAPI_ASSERT(env, error_info->error_message,
"Last error info message should not be null");

return nullptr;
}

Expand Down