-
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
feat: allow catching all exceptions #1593
base: main
Are you sure you want to change the base?
Conversation
I'd like to discuss the naming of the new define We can use |
We discuss in the 18 Oct Node-API meeting:
|
@@ -78,43 +78,61 @@ inline napi_status AttachData(napi_env env, | |||
// For use in JS to C++ callback wrappers to catch any Napi::Error exceptions | |||
// and rethrow them as JavaScript exceptions before returning from the callback. | |||
template <typename Callable> | |||
inline napi_value WrapCallback(Callable callback) { | |||
#ifdef NAPI_CPP_EXCEPTIONS | |||
inline napi_value WrapCallback(napi_env env, Callable callback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are adding the env
parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is needed to construct a new Error object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this branch in sync with the main
?
fc130ef
to
22357ab
Compare
Adds new compile-time define (
NAPI_CPP_EXCEPTIONS_ALL
) to enable catching all exceptions.Must be under a flag to be semver minor.
TODO:
Fixes: #1555