From 636737bdd5b3f82edc5d7edc668a62ebe03d382d Mon Sep 17 00:00:00 2001 From: Jon Moss Date: Fri, 22 Dec 2017 22:30:20 -0500 Subject: [PATCH] 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 Reviewed-By: Anatoli Papirovski Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca --- src/async_wrap.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/async_wrap.cc b/src/async_wrap.cc index 3f77169321a919..71599eecbda127 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -342,8 +342,7 @@ static void PromiseHook(PromiseHookType type, Local promise, static void SetupHooks(const FunctionCallbackInfo& 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