Permalink
Browse files

n-api: make test_error functions static

PR-URL: #20373
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
  • Loading branch information...
gabrielschulhof committed Apr 27, 2018
1 parent b4ca3a4 commit cd8ed1c447518af1cb54ad73f0cde34e44cbc320
Showing with 15 additions and 15 deletions.
  1. +15 −15 test/addons-napi/test_error/test_error.c
@@ -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));
@@ -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(
@@ -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(
@@ -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(
@@ -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(
@@ -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;
@@ -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;
@@ -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;
@@ -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),

0 comments on commit cd8ed1c

Please sign in to comment.