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

objectwrap: gracefully handle constructor exceptions #600

Closed
wants to merge 4 commits into from

Commits on Jan 7, 2020

  1. objectwrap: gracefully handle constructor exceptions

    Ensure that no native instance pointer is associated with the
    JavaScript object under construction if the native constructor causes a
    JavaScript exception to be thrown.
    
    Two different cases must be taken into consideration:
    
    1. The exception in the constructor was caused by
       `ObjectWrap<T>::ObjectWrap` when the call to `napi_wrap()` failed.
    2. The exception in the constructor was caused by the constructor of
       the subclass of `ObjectWrap<T>` after `napi_wrap()` was already
       successful.
    
    Fixes: nodejs#599
    Co-authored-by: blagoev <[email protected]>
    PR-URL: nodejs#600
    Gabriel Schulhof and blagoev committed Jan 7, 2020
    Configuration menu
    Copy the full SHA
    8cf3755 View commit details
    Browse the repository at this point in the history
  2. remove static cast in constructor

    Gabriel Schulhof committed Jan 7, 2020
    Configuration menu
    Copy the full SHA
    b00638c View commit details
    Browse the repository at this point in the history
  3. perform some renames to better reflect semantics

    Gabriel Schulhof committed Jan 7, 2020
    Configuration menu
    Copy the full SHA
    868b4bd View commit details
    Browse the repository at this point in the history

Commits on Jan 9, 2020

  1. test for a specific exception

    Gabriel Schulhof committed Jan 9, 2020
    Configuration menu
    Copy the full SHA
    bd465de View commit details
    Browse the repository at this point in the history