diff options
author | Jon Moss <me@jonathanmoss.me> | 2017-12-22 22:30:20 -0500 |
---|---|---|
committer | Jon Moss <me@jonathanmoss.me> | 2017-12-24 21:59:57 -0500 |
commit | 81c2b59609b5a354219acc5cc0f376be5be86cc4 (patch) | |
tree | e5d45e367ed2285c77d604406d2d3b78c8ecd036 /src/async_wrap.cc | |
parent | c08f0d16e7e4701119e5dac3ac3a859ede3dcc12 (diff) | |
download | node-new-81c2b59609b5a354219acc5cc0f376be5be86cc4.tar.gz |
async_hooks: use CHECK instead of throwing error
SetupHooks is only available via `process.binding('async_wrap')`, so
there's no reason it shouldn't be called with the appropriate arguments,
since it is an internal-only function. The only place this function is
used is `lib/internal/async_hooks.js`.
PR-URL: https://github.com/nodejs/node/pull/17832
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'src/async_wrap.cc')
-rw-r--r-- | src/async_wrap.cc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/async_wrap.cc b/src/async_wrap.cc index 79d54b1000..e87ebec3d3 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -343,8 +343,7 @@ static void PromiseHook(PromiseHookType type, Local<Promise> promise, static void SetupHooks(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); - if (!args[0]->IsObject()) - return env->ThrowTypeError("first argument must be an object"); + CHECK(args[0]->IsObject()); // All of init, before, after, destroy are supplied by async_hooks // internally, so this should every only be called once. At which time all |