-
Notifications
You must be signed in to change notification settings - Fork 459
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
Exceptions thrown in Init don't make it to JavaScript #239
Comments
It looks like this may be a bug in NAPI itself. Running a modified version of NAPI's hello world which throws an exception after adding the
Removing the call to hello causes no exception to be reported at all. Doing the same with node-addon-api produces the same behavior. |
Any chance you've confirmed it has the correct behaviour with a non n-api addon ? |
Verified, it does work when not using N-API. In a pure V8-only addon: void Init(Handle<Object> exports) {
Isolate* isolate = Isolate::GetCurrent();
exports->Set(String::NewFromUtf8(isolate, "hello"),
FunctionTemplate::New(isolate, Method)->GetFunction());
isolate->ThrowException(String::NewFromUtf8(isolate, "Test error"));
} I get:
|
Also, I did put this on the |
@fluggo thanks for validating, will help narrow down where to start looking. |
Believe this was fixed in nodejs/node#19437. Please re-open if that is not the case. @fluggo thanks for reporting. |
I suspect the problem is with the underlying NAPI than this project, because when I trace the code, it looks like node-addon-api does everything it's supposed to do. But this is the API where I found the problem, so I'm reporting it here.
test.cpp:
binding.gyp:
index.js:
Output:
The text was updated successfully, but these errors were encountered: