-
Notifications
You must be signed in to change notification settings - Fork 34
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
Can't use node::FatalError() #232
Comments
FatalError() is a noreturn function. Its n-api equivalent shouldn't throw an exception, it should exit. |
Just copying Node’s
Just curious, is that publicly announced anywhere? |
Not really, but V8 people have repeatedly indicated over the years they want to get rid of it. |
@addaleax well, it's actually more than that, because in Windows it's |
@bnoordhuis we were originally debating whether we should consider the absence of an |
But without an |
We can wrap the call to |
I'm still not convinced we need |
Related: nodejs/node-addon-api#25 |
src/node_api.cc must build both as a part of node and as an addon against an older version of node, so that it may be possible to make N-API available on older, already-published versions of node. Thus, it must not make use of node internals such as node::FatalError(). Yet N-API must also exit with a fatal error in the absence of a napi_env pointer. To that end, node::FatalError() is implemented if internals are unavailable by copying PrintErrorString() from node.cc, simplifying it to accept only a location and an error message, and augmenting it with fflush() and platform-ifdefed abort(), the latter two of which are also copied from node.cc. Re nodejs#232 Re https://github.com/nodejs/node-api
We might want to actually expose |
Addressed by nodejs/node#13971 |
... because node_internals.h is not available outside of node. So, if we want node-api to contain unaltered versions of the implementation, we must not rely on any node internals.
I guess we could simply throw a JS exception. Since
Isolate::GetCurrent()
is going away, and since we don't have an env from which to extract an isolate, is there some other way we can signal that we wish to throw an exception?The text was updated successfully, but these errors were encountered: