src: handle failure during error wrap of primitive#1310
Closed
gabrielschulhof wants to merge 1 commit intonodejs:mainfrom
Closed
src: handle failure during error wrap of primitive#1310gabrielschulhof wants to merge 1 commit intonodejs:mainfrom
gabrielschulhof wants to merge 1 commit intonodejs:mainfrom
Conversation
When we wrap a primitive value into an object in order to throw it as an error, we call `napi_define_properties()` which may return `napi_pending_exception` if the environment is shutting down. Handle this case when `NODE_API_SWALLOW_UNTHROWABLE_EXCEPTIONS` is given by checking whether we're in an environment shutdown scenario and ignore the failure of `napi_define_properties()`, since the error will not reach JS anyway.
Contributor
Author
|
Note that this change will become mostly dead code because we're only down this path if |
legendecas
approved these changes
Apr 26, 2023
Contributor
Author
gabrielschulhof
added a commit
that referenced
this pull request
Apr 29, 2023
When we wrap a primitive value into an object in order to throw it as an error, we call `napi_define_properties()` which may return `napi_pending_exception` if the environment is shutting down. Handle this case when `NODE_API_SWALLOW_UNTHROWABLE_EXCEPTIONS` is given by checking whether we're in an environment shutdown scenario and ignore the failure of `napi_define_properties()`, since the error will not reach JS anyway. Signed-off-by: Gabriel Schulhof <gabrielschulhof@gmail.com> PR-URL: #1310 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
Contributor
Author
|
Landed in 64f6515. |
johnfrench3
pushed a commit
to johnfrench3/node-addon-api-git
that referenced
this pull request
Aug 11, 2023
When we wrap a primitive value into an object in order to throw it as an error, we call `napi_define_properties()` which may return `napi_pending_exception` if the environment is shutting down. Handle this case when `NODE_API_SWALLOW_UNTHROWABLE_EXCEPTIONS` is given by checking whether we're in an environment shutdown scenario and ignore the failure of `napi_define_properties()`, since the error will not reach JS anyway. Signed-off-by: Gabriel Schulhof <gabrielschulhof@gmail.com> PR-URL: nodejs/node-addon-api#1310 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When we wrap a primitive value into an object in order to throw it as an error, we call
napi_define_properties()which may returnnapi_pending_exceptionif the environment is shutting down. Handle this case whenNODE_API_SWALLOW_UNTHROWABLE_EXCEPTIONSis given by checking whether we're in an environment shutdown scenario and ignore the failure ofnapi_define_properties(), since the error will not reach JS anyway.