Skip to content

Commit

Permalink
n-api: make test_error functions static
Browse files Browse the repository at this point in the history
PR-URL: #20373
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
  • Loading branch information
Gabriel Schulhof authored and MylesBorins committed May 8, 2018
1 parent d7db306 commit 17dbf6c
Showing 1 changed file with 15 additions and 15 deletions.
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

0 comments on commit 17dbf6c

Please sign in to comment.