Skip to content

Commit

Permalink
async_hooks: use CHECK instead of throwing error
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
maclover7 authored and gibfahn committed Jan 17, 2018
1 parent 8e8d0b3 commit 42a8fde
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/async_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,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
Expand Down

0 comments on commit 42a8fde

Please sign in to comment.