0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/addons-napi/test_fatal/test_fatal.c
Kyle Farnung 73078d6072 n-api: add napi_fatal_error API
PR-URL: https://github.com/nodejs/node/pull/13971
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jason Ginchereau <jasongin@microsoft.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-07-13 18:48:27 -04:00

19 lines
503 B
C

#include <node_api.h>
#include "../common.h"
napi_value Test(napi_env env, napi_callback_info info) {
napi_fatal_error("test_fatal::Test", "fatal message");
return NULL;
}
void Init(napi_env env, napi_value exports, napi_value module, void* priv) {
napi_property_descriptor properties[] = {
DECLARE_NAPI_PROPERTY("Test", Test),
};
NAPI_CALL_RETURN_VOID(env, napi_define_properties(
env, exports, sizeof(properties) / sizeof(*properties), properties));
}
NAPI_MODULE(addon, Init)