Skip to content

Commit 0f7c898

Browse files
maclover7MylesBorins
authored andcommitted
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`. Backport-PR-URL: #18179 PR-URL: #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>
1 parent 089f18e commit 0f7c898

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/async_wrap.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,7 @@ static void PromiseHook(PromiseHookType type, Local<Promise> promise,
365365
static void SetupHooks(const FunctionCallbackInfo<Value>& args) {
366366
Environment* env = Environment::GetCurrent(args);
367367

368-
if (!args[0]->IsObject())
369-
return env->ThrowTypeError("first argument must be an object");
368+
CHECK(args[0]->IsObject());
370369

371370
// All of init, before, after, destroy are supplied by async_hooks
372371
// internally, so this should every only be called once. At which time all

0 commit comments

Comments
 (0)