Skip to content

Commit 42a8fde

Browse files
maclover7gibfahn
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`. PR-URL: nodejs#17832 Backport-PR-URL: nodejs#18179 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 8e8d0b3 commit 42a8fde

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)