Skip to content

Commit 0843ed6

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`. PR-URL: #17832 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 fea5d08 commit 0843ed6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/async_wrap.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,7 @@ static void PromiseHook(PromiseHookType type, Local<Promise> promise,
342342
static void SetupHooks(const FunctionCallbackInfo<Value>& args) {
343343
Environment* env = Environment::GetCurrent(args);
344344

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

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

0 commit comments

Comments
 (0)