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

scopes: make failure of closing scopes fatal #566

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions napi-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3472,7 +3472,10 @@ inline HandleScope::HandleScope(Napi::Env env) : _env(env) {
}

inline HandleScope::~HandleScope() {
napi_close_handle_scope(_env, _scope);
napi_status status = napi_close_handle_scope(_env, _scope);
NAPI_FATAL_IF_FAILED(status,
"HandleScope::~HandleScope",
"napi_close_handle_scope");
}

inline HandleScope::operator napi_handle_scope() const {
Expand All @@ -3497,7 +3500,10 @@ inline EscapableHandleScope::EscapableHandleScope(Napi::Env env) : _env(env) {
}

inline EscapableHandleScope::~EscapableHandleScope() {
napi_close_escapable_handle_scope(_env, _scope);
napi_status status = napi_close_escapable_handle_scope(_env, _scope);
NAPI_FATAL_IF_FAILED(status,
"EscapableHandleScope::~EscapableHandleScope",
"napi_close_escapable_handle_scope");
}

inline EscapableHandleScope::operator napi_escapable_handle_scope() const {
Expand Down Expand Up @@ -3533,7 +3539,10 @@ inline CallbackScope::CallbackScope(napi_env env, napi_async_context context)
}

inline CallbackScope::~CallbackScope() {
napi_close_callback_scope(_env, _scope);
napi_status status = napi_close_callback_scope(_env, _scope);
NAPI_FATAL_IF_FAILED(status,
"CallbackScope::~CallbackScope",
"napi_close_callback_scope");
}

inline CallbackScope::operator napi_callback_scope() const {
Expand Down