X Tutup
The Wayback Machine - https://web.archive.org/web/20220405131449/https://github.com/nodejs/node-addon-api/pull/52/commits
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

Conditional support for C++ exceptions #52

Merged
merged 3 commits into from Jun 9, 2017
Merged

Commits on Jun 6, 2017

  1. Conditional support for C++ exceptions

    Enable using the N-API C++ wrapper classes with or without C++
    exceptions. See the updated `Napi::Error` class documentation for an
    overview of the developer experience.
    
     - Add a `NAPI_CPP_EXCEPTIONS` preprocessor symbol that is defined
       when C++ exceptions are enabled.
     - Add `Env::GetAndClearPendingException()` method.
     - Add `Value::IsEmpty()` method.
     - Update documentation on Error class to provide parallel
       explanation and examples for error-handling without C++ exceptions.
     - Update README to mention optional C++ exception support.
     - Define a `NAPI_THROW_IF_FAILED()` macro that throws either a C++
       or JS exception depending on whether `NAPI_CPP_EXCEPTIONS` is
       defined.
     - Define a `details::WrapCallback()` helper function that catches C++
       exceptions thrown from callbacks, only if `NAPI_CPP_EXCEPTIONS`
       is defined.
     - Update implementation of all methods to use `NAPI_THROW_IF_FAILED()`
       and `details::WrapCallback()` as appropriate.
     - Fix a bug in `Error::New()` when there was a pending exception but
       some different error status was reported by the last error info.
     - Update `test/binding.gyp` to build two separate modules, with and
       without C++ exceptions enabled.
     - Update test JS code to run the same tests against both modules.
     - Update test C++ code to throw JS exceptions (to be compatible with
       both modes).
     - Add some additional test cases to verify expected exceptions are
       observed from JS regardless of whether C++ exceptions are enabled
       or not.
     - Change CI config to ignore failures on nightly builds.
    jasongin committed Jun 6, 2017
X Tutup