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

napi_throw_error function syntax in Node v8.2.1 and below is different from N-API V1 docs #778

Closed
kanikashah90 opened this issue Jul 27, 2020 · 2 comments

Comments

@kanikashah90
Copy link

In Node v8.2.1 N-API docs syntax for napi_throw_error is:
NODE_EXTERN napi_status napi_throw_error(napi_env env, const char* msg);

Whereas in the latest Node v14 docs syntax is:
NAPI_EXTERN napi_status napi_throw_error(napi_env env, const char* code, const char* msg);
Node v14 docs mention that this method was introduced in N-API version 1 in Node v8.0.0.

code argument is missing in the Node v8.2.1.

When I compile my native add-on compiled using NAPI in Node v8.17.0 it fails to work in Node v8.2.1. And due to syntax differences, the module fails to compile on 8.2.1.

@NickNaso
Copy link
Member

Hi @kanikashah90,
this issue is correlated to this other one #760, now we are updating the documentation in the core through this PR nodejs/node#34344.

The first version that matches version 1 is 8.6.0. N-API was introduced in version v.8.0.0 as experimental and version 1 continued to evolve until v8.7.0 and therefore the shape of the API in earlier versions is not truly version 1 (in hindsight we should have called it version 0). We recommend version 3 or later.

Hope that this help you.

@gabrielschulhof
Copy link
Contributor

The documentation fix to address this issue has landed in core at nodejs/node#34344.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants