diff options
author | Gabriel Schulhof <gabriel.schulhof@intel.com> | 2020-11-14 00:07:36 +0300 |
---|---|---|
committer | Gabriel Schulhof <gabriel.schulhof@intel.com> | 2020-11-16 08:48:27 +0300 |
commit | 2fd22353ea1ab6d24057e247635cebbbb180da91 (patch) | |
tree | a591f590d15a08481ebae740664391e3f3824fa2 /src/node_api.cc | |
parent | 187ce5bd06e98aeb114228327772bbab61535684 (diff) |
n-api: factor out calling pattern
Factor out how we handle a `napi_status`-valued return internally.
Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
PR-URL: https://github.com/nodejs/node/pull/36113
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src/node_api.cc')
-rw-r--r-- | src/node_api.cc | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/node_api.cc b/src/node_api.cc index 4e932c19c2b..f1a5265b6a7 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -1130,11 +1130,8 @@ napi_status napi_queue_async_work(napi_env env, napi_async_work work) { CHECK_ENV(env); CHECK_ARG(env, work); - napi_status status; uv_loop_t* event_loop = nullptr; - status = napi_get_uv_event_loop(env, &event_loop); - if (status != napi_ok) - return napi_set_last_error(env, status); + STATUS_CALL(napi_get_uv_event_loop(env, &event_loop)); uvimpl::Work* w = reinterpret_cast<uvimpl::Work*>(work); |