Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

n-api: make test_error functions static #20373

Closed
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
30 changes: 15 additions & 15 deletions test/addons-napi/test_error/test_error.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <node_api.h>
#include "../common.h"

napi_value checkError(napi_env env, napi_callback_info info) {
static napi_value checkError(napi_env env, napi_callback_info info) {
size_t argc = 1;
napi_value args[1];
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL));
Expand All @@ -15,7 +15,7 @@ napi_value checkError(napi_env env, napi_callback_info info) {
return result;
}

napi_value throwExistingError(napi_env env, napi_callback_info info) {
static napi_value throwExistingError(napi_env env, napi_callback_info info) {
napi_value message;
napi_value error;
NAPI_CALL(env, napi_create_string_utf8(
Expand All @@ -25,42 +25,42 @@ napi_value throwExistingError(napi_env env, napi_callback_info info) {
return NULL;
}

napi_value throwError(napi_env env, napi_callback_info info) {
static napi_value throwError(napi_env env, napi_callback_info info) {
NAPI_CALL(env, napi_throw_error(env, NULL, "error"));
return NULL;
}

napi_value throwRangeError(napi_env env, napi_callback_info info) {
static napi_value throwRangeError(napi_env env, napi_callback_info info) {
NAPI_CALL(env, napi_throw_range_error(env, NULL, "range error"));
return NULL;
}

napi_value throwTypeError(napi_env env, napi_callback_info info) {
static napi_value throwTypeError(napi_env env, napi_callback_info info) {
NAPI_CALL(env, napi_throw_type_error(env, NULL, "type error"));
return NULL;
}

napi_value throwErrorCode(napi_env env, napi_callback_info info) {
static napi_value throwErrorCode(napi_env env, napi_callback_info info) {
NAPI_CALL(env, napi_throw_error(env, "ERR_TEST_CODE", "Error [error]"));
return NULL;
}

napi_value throwRangeErrorCode(napi_env env, napi_callback_info info) {
static napi_value throwRangeErrorCode(napi_env env, napi_callback_info info) {
NAPI_CALL(env, napi_throw_range_error(env,
"ERR_TEST_CODE",
"RangeError [range error]"));
return NULL;
}

napi_value throwTypeErrorCode(napi_env env, napi_callback_info info) {
static napi_value throwTypeErrorCode(napi_env env, napi_callback_info info) {
NAPI_CALL(env, napi_throw_type_error(env,
"ERR_TEST_CODE",
"TypeError [type error]"));
return NULL;
}


napi_value createError(napi_env env, napi_callback_info info) {
static napi_value createError(napi_env env, napi_callback_info info) {
napi_value result;
napi_value message;
NAPI_CALL(env, napi_create_string_utf8(
Expand All @@ -69,7 +69,7 @@ napi_value createError(napi_env env, napi_callback_info info) {
return result;
}

napi_value createRangeError(napi_env env, napi_callback_info info) {
static napi_value createRangeError(napi_env env, napi_callback_info info) {
napi_value result;
napi_value message;
NAPI_CALL(env, napi_create_string_utf8(
Expand All @@ -78,7 +78,7 @@ napi_value createRangeError(napi_env env, napi_callback_info info) {
return result;
}

napi_value createTypeError(napi_env env, napi_callback_info info) {
static napi_value createTypeError(napi_env env, napi_callback_info info) {
napi_value result;
napi_value message;
NAPI_CALL(env, napi_create_string_utf8(
Expand All @@ -87,7 +87,7 @@ napi_value createTypeError(napi_env env, napi_callback_info info) {
return result;
}

napi_value createErrorCode(napi_env env, napi_callback_info info) {
static napi_value createErrorCode(napi_env env, napi_callback_info info) {
napi_value result;
napi_value message;
napi_value code;
Expand All @@ -99,7 +99,7 @@ napi_value createErrorCode(napi_env env, napi_callback_info info) {
return result;
}

napi_value createRangeErrorCode(napi_env env, napi_callback_info info) {
static napi_value createRangeErrorCode(napi_env env, napi_callback_info info) {
napi_value result;
napi_value message;
napi_value code;
Expand All @@ -113,7 +113,7 @@ napi_value createRangeErrorCode(napi_env env, napi_callback_info info) {
return result;
}

napi_value createTypeErrorCode(napi_env env, napi_callback_info info) {
static napi_value createTypeErrorCode(napi_env env, napi_callback_info info) {
napi_value result;
napi_value message;
napi_value code;
Expand All @@ -135,7 +135,7 @@ static napi_value throwArbitrary(napi_env env, napi_callback_info info) {
return NULL;
}

napi_value Init(napi_env env, napi_value exports) {
static napi_value Init(napi_env env, napi_value exports) {
napi_property_descriptor descriptors[] = {
DECLARE_NAPI_PROPERTY("checkError", checkError),
DECLARE_NAPI_PROPERTY("throwExistingError", throwExistingError),
Expand Down